Skip to content

Commit

Permalink
build Docker image for ket
Browse files Browse the repository at this point in the history
  • Loading branch information
ushitora-anqou committed Oct 13, 2024
1 parent 82dc6d6 commit 446b5b7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/ket-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: (ket) Publish Docker image to ghcr.io

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+.[0-9]"

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/#-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: metadata
run: echo "version=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")" >> "$GITHUB_OUTPUT"

- name: Build and push Docker image for mastodon
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/ushitora-anqou/ket-mastodon:${{ steps.metadata.outputs.version }}
build-args: |
MASTODON_SOURCE_TAG=${{ steps.metadata.outputs.version }}
- name: Build and push Docker image for mastodon-streaming
uses: docker/build-push-action@v5
with:
context: .
file: streaming/Dockerfile
push: true
tags: ghcr.io/ushitora-anqou/ket-mastodon-streaming:${{ steps.metadata.outputs.version }}
build-args: |
MASTODON_SOURCE_TAG=${{ steps.metadata.outputs.version }}
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ ARG MASTODON_VERSION_PRERELEASE=""
# Append build metadata or fork information to version.rb [--build-arg MASTODON_VERSION_METADATA="pr-123456"]
ARG MASTODON_VERSION_METADATA=""

ARG MASTODON_SOURCE_TAG=""

# Allow Ruby on Rails to serve static files
# See: https://docs.joinmastodon.org/admin/config/#rails_serve_static_files
ARG RAILS_SERVE_STATIC_FILES="true"
Expand All @@ -52,7 +54,11 @@ ENV \
RAILS_SERVE_STATIC_FILES=${RAILS_SERVE_STATIC_FILES} \
RUBY_YJIT_ENABLE=${RUBY_YJIT_ENABLE} \
# Apply timezone
TZ=${TZ}
TZ=${TZ} \
# Custom settings
GITHUB_REPOSITORY="ushitora-anqou/mastodon" \
SOURCE_BASE_URL="https://github.com/ushitora-anqou/mastodon" \
SOURCE_TAG="${MASTODON_SOURCE_TAG}"

ENV \
# Configure the IP to bind Mastodon to when serving traffic
Expand Down Expand Up @@ -408,3 +414,5 @@ USER mastodon
EXPOSE 3000
# Set container tini as default entry point
ENTRYPOINT ["/usr/bin/tini", "--"]

LABEL org.opencontainers.image.source="https://github.com/ushitora-anqou/mastodon/blob/master/Dockerfile"

0 comments on commit 446b5b7

Please # to comment.