From 94dd817379d3ab9271107d25bef97a9547bd9750 Mon Sep 17 00:00:00 2001 From: filipton Date: Tue, 25 Jun 2024 16:10:03 +0200 Subject: [PATCH] chore: github action to build docker --- .github/workflows/publish-docker-image.yml | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/publish-docker-image.yml diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml new file mode 100644 index 0000000..b10f13d --- /dev/null +++ b/.github/workflows/publish-docker-image.yml @@ -0,0 +1,62 @@ +name: Publish docker image + +on: + push: + branches: + - master + +env: + REGISTRY: ghcr.io + IMAGE_NAME_SERVER: fkmtime/fkmtime-proxy-server + IMAGE_NAME_CLIENT: fkmtime/fkmtime-proxied-nginx + +jobs: + push: + name: Push to ghcr.io + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_SERVER }} + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v6 + with: + context: ./ + file: Dockerfile + target: proxy-server + push: true + platforms: linux/amd64, linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Extract Docker metadata 2 + id: meta2 + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_CLIENT }} + - name: Build and push Docker image 2 + id: build-and-push2 + uses: docker/build-push-action@v6 + with: + context: ./ + file: Dockerfile + target: proxy-client + push: true + platforms: linux/amd64, linux/arm64 + tags: ${{ steps.meta2.outputs.tags }} + labels: ${{ steps.meta2.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max