Docker Image Release #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Publishes the Docker image to DockerHub | |
name: Docker Image Release | |
on: workflow_dispatch | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release-docker-image: | |
name: Build and Release powersync-service Docker Image | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# check out full history | |
# Temporarily needed for changesets | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# This uses the service's package.json version for the Docker Image tag | |
- name: Get Service Version from package.json | |
id: get_version | |
run: echo "SERVICE_VERSION=$(node -p "require('./service/package.json').version")" >> $GITHUB_OUTPUT | |
- name: Build Image and Push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/arm64,linux/amd64 | |
cache-from: type=registry,ref=${{vars.DOCKER_REGISTRY}}:latest | |
context: . | |
tags: ${{vars.DOCKER_REGISTRY}}:latest,${{vars.DOCKER_REGISTRY}}:${{steps.get_version.outputs.SERVICE_VERSION}} | |
push: true | |
file: ./service/Dockerfile | |
# TODO remove this when removing Journey Micro | |
build-args: | | |
GITHUB_TOKEN=${{secrets.RESTRICTED_PACKAGES_TOKEN}} | |
# # Updates the README section on the DockerHub page | |
- name: Update repo description | |
# Note that this 3rd party extention is recommended in the DockerHub docs: | |
# https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/ | |
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: ${{vars.DOCKER_REGISTRY}} | |
# This is the contents of what will be shown on DockerHub | |
readme-filepath: ./service/README.md |