feat(server): make both servers deployable as container images (#147)
This commit is contained in:
1 parent
70449971cb
commit
aba1226794
33 files changed
+825
-40
No files matched your search
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Jar members are listed because a key has only ever travelled inside one, never loose.
|
||||
set -euo pipefail
|
||||
|
||||
found=$(
|
||||
find server.login/build/install server.game/build/install -type f
|
||||
find server.login/build/install server.game/build/install -name '*.jar' -exec unzip -Z1 {} \;
|
||||
for archive in server.login/build/distributions/*.tar server.game/build/distributions/*.tar; do
|
||||
if [ -f "$archive" ]; then tar -tf "$archive"; fi
|
||||
done
|
||||
)
|
||||
|
||||
if grep -q '\.pem$' <<<"$found"; then
|
||||
echo "::error::a published artifact bundles a key"
|
||||
grep '\.pem$' <<<"$found"
|
||||
exit 1
|
||||
fi
|
||||
echo "No keys in $(grep -c . <<<"$found") packaged entries."
|
||||
@@ -0,0 +1,94 @@
|
||||
name: Dev images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
# Only the newest master is worth an image, so supersede a run still in flight.
|
||||
concurrency:
|
||||
group: dev-images-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish dev server images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up JDK 25
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "25"
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
# No ROMs on the runner, so dialog ids are placeholders.
|
||||
- name: Build distributions
|
||||
run: ./gradlew :server.login:installDist :server.game:installDist
|
||||
|
||||
- name: Check no keys are bundled
|
||||
run: bash .github/scripts/check-no-keys.sh
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Log in to the GitHub container registry
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Describe the login server image
|
||||
id: login-image
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/openmmo-login
|
||||
flavor: latest=false
|
||||
labels: org.opencontainers.image.title=OpenMMO login server
|
||||
annotations: org.opencontainers.image.title=OpenMMO login server
|
||||
tags: |
|
||||
type=raw,value=dev
|
||||
type=sha,format=short
|
||||
|
||||
- name: Publish the login server image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: server.login/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.login-image.outputs.tags }}
|
||||
labels: ${{ steps.login-image.outputs.labels }}
|
||||
annotations: ${{ steps.login-image.outputs.annotations }}
|
||||
|
||||
- name: Describe the game server image
|
||||
id: game-image
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/openmmo-game
|
||||
flavor: latest=false
|
||||
labels: org.opencontainers.image.title=OpenMMO game server
|
||||
annotations: org.opencontainers.image.title=OpenMMO game server
|
||||
tags: |
|
||||
type=raw,value=dev
|
||||
type=sha,format=short
|
||||
|
||||
- name: Publish the game server image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: server.game/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.game-image.outputs.tags }}
|
||||
labels: ${{ steps.game-image.outputs.labels }}
|
||||
annotations: ${{ steps.game-image.outputs.annotations }}
|
||||
@@ -31,10 +31,13 @@ jobs:
|
||||
manifest-file: .release-please-manifest.json
|
||||
|
||||
publish:
|
||||
name: Publish server distributions
|
||||
name: Publish server distributions and images
|
||||
needs: release-please
|
||||
if: needs.release-please.outputs.released == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout the release tag
|
||||
uses: actions/checkout@v7
|
||||
@@ -53,19 +56,14 @@ jobs:
|
||||
|
||||
# No ROMs on the runner, so dialog ids are placeholders.
|
||||
- name: Build distributions
|
||||
run: ./gradlew :server.login:assembleDist :server.game:assembleDist
|
||||
run: >
|
||||
./gradlew :server.login:assembleDist :server.game:assembleDist
|
||||
:server.login:installDist :server.game:installDist
|
||||
|
||||
- name: Check no keys are bundled
|
||||
run: |
|
||||
found=$(tar -tf server.login/build/distributions/*.tar \
|
||||
&& tar -tf server.game/build/distributions/*.tar)
|
||||
if grep -q '\.pem$' <<<"$found"; then
|
||||
echo "::error::a distribution bundles a key"
|
||||
grep '\.pem$' <<<"$found"
|
||||
exit 1
|
||||
fi
|
||||
echo "No keys in the distributions."
|
||||
run: bash .github/scripts/check-no-keys.sh
|
||||
|
||||
# Before the images, so a registry failure cannot leave a tagged release with no archives.
|
||||
- name: Attach distributions to the release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -74,3 +72,57 @@ jobs:
|
||||
server.login/build/distributions/* \
|
||||
server.game/build/distributions/* \
|
||||
--clobber
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Log in to the GitHub container registry
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Describe the login server image
|
||||
id: login-image
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/openmmo-login
|
||||
flavor: latest=true
|
||||
labels: org.opencontainers.image.title=OpenMMO login server
|
||||
annotations: org.opencontainers.image.title=OpenMMO login server
|
||||
tags: |
|
||||
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.tag }}
|
||||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.tag }}
|
||||
|
||||
- name: Publish the login server image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: server.login/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.login-image.outputs.tags }}
|
||||
labels: ${{ steps.login-image.outputs.labels }}
|
||||
annotations: ${{ steps.login-image.outputs.annotations }}
|
||||
|
||||
- name: Describe the game server image
|
||||
id: game-image
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/openmmo-game
|
||||
flavor: latest=true
|
||||
labels: org.opencontainers.image.title=OpenMMO game server
|
||||
annotations: org.opencontainers.image.title=OpenMMO game server
|
||||
tags: |
|
||||
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.tag }}
|
||||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.tag }}
|
||||
|
||||
- name: Publish the game server image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: server.game/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.game-image.outputs.tags }}
|
||||
labels: ${{ steps.game-image.outputs.labels }}
|
||||
annotations: ${{ steps.game-image.outputs.annotations }}
|
||||
Reference in new issue
Block a user