Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Publish container

on:
push:
branches: [master]
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
build:
strategy:
matrix:
build-targets:
- label: ubuntu-latest
arch: amd64
manifest-name: x64
- label: ubuntu-24.04-arm
arch: arm64
manifest-name: arm64
permissions:
contents: read
packages: write
name: Build Container for ${{ matrix.build-targets.manifest-name }}
runs-on: ${{ matrix.build-targets.label }}

steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: |
# First, lowercase-ify owner
export owner=${{ github.repository_owner }}
export owner=${owner,,}
docker buildx build \
--platform linux/${{ matrix.build-targets.arch }} \
--push \
-t "ghcr.io/${owner}/bayshore:${{ matrix.build-targets.manifest-name }}-${{ github.sha }}" \
-t "ghcr.io/${owner}/bayshore:${{ matrix.build-targets.manifest-name }}-latest" \
--provenance false \
.
merge-container:
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
packages: write
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Merge images
run: |
# First, lowercase-ify owner
export owner=${{ github.repository_owner }}
export owner=${owner,,}
docker manifest create "ghcr.io/${owner}/bayshore:latest" \
--amend "ghcr.io/${owner}/bayshore:arm64-${{ github.sha }}" \
--amend "ghcr.io/${owner}/bayshore:x64-${{ github.sha }}"
docker manifest push "ghcr.io/${owner}/bayshore:latest"

docker manifest create "ghcr.io/${owner}/bayshore:${{ github.sha }}" \
--amend "ghcr.io/${owner}/bayshore:arm64-${{ github.sha }}" \
--amend "ghcr.io/${owner}/bayshore:x64-${{ github.sha }}"
docker manifest push "ghcr.io/${owner}/bayshore:${{ github.sha }}"
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ RUN npm ci && \
COPY --from=builder /server/dist /home/node/dist

# Copy game configuration file and certificate
COPY server_wangan.key server_wangan.crt config.json ./
COPY server_wangan.key server_wangan.crt ./

VOLUME [ "/home/node/config.json" ]

# This ensures that the final dist files are readonly to this node user when running the application.
USER node
Expand Down