diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 79bc1b815..4d406c1b6 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -9,6 +9,7 @@ on: - 'webclient/**' - '.github/workflows/web-*.yml' - '.github/workflows/translations-*.yml' + - '.github/workflows/docker-release.yml' tags: - '*' pull_request: diff --git a/.github/workflows/desktop-lint.yml b/.github/workflows/desktop-lint.yml index 4ebfd9b79..aee6e81d5 100644 --- a/.github/workflows/desktop-lint.yml +++ b/.github/workflows/desktop-lint.yml @@ -7,6 +7,7 @@ on: - 'webclient/**' - '.github/workflows/web-*.yml' - '.github/workflows/translations-*.yml' + - '.github/workflows/docker-release.yml' jobs: format: diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 000000000..439ea24cd --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,71 @@ +name: Build Docker Container + +on: + push: + tags: + - '*Release*' + branches: + - master + pull_request: + branches: + - master + paths: + - '.github/workflows/docker-release.yml' + - 'CMakeLists.txt' + - 'Dockerfile' + - 'servatrice/**' + - 'common/**' + - 'cmake/**' + - '!**.md' + +jobs: + docker: + name: amd64 & arm64 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Docker metadata + id: metadata + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/cockatrice/servatrice + labels: | + org.opencontainers.image.title=Servatrice + org.opencontainers.image.url=https://cockatrice.github.io/ + org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games + annotations: | + org.opencontainers.image.title=Servatrice + org.opencontainers.image.url=https://cockatrice.github.io/ + org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + if: github.ref_type == 'tag' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Build and push Docker Image + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref_type == 'tag' }} + tags: ${{ steps.metadata.outputs.tags }} + labels: ${{ steps.metadata.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 330c51b4a..2a0d10eba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,11 @@ RUN apt-get update && apt-get install -y\ qt6-tools-dev \ qt6-tools-dev-tools -COPY . /home/servatrice/code/ +COPY ./CMakeLists.txt ./LICENSE ./README.md /home/servatrice/code/ +COPY ./cmake /home/servatrice/code/cmake +COPY ./common /home/servatrice/code/common +COPY ./servatrice /home/servatrice/code/servatrice + WORKDIR /home/servatrice/code WORKDIR build diff --git a/README.md b/README.md index 0a8058bba..48cacff78 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,6 @@ The following flags (with their non-default values) can be passed to `cmake`: # Run - Cockatrice is the game client
Oracle fetches card data
Servatrice is the server