Update docker-build.yml #11
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
name: Build and Push Docker Images | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: [backend, worker, worker-cli] | |
include: | |
- service: backend | |
dockerfile: docker/docker/backend/Dockerfile | |
context: docker/docker/backend | |
- service: worker | |
dockerfile: docker/docker/worker/Dockerfile | |
context: docker/docker/worker | |
- service: worker-cli | |
dockerfile: docker/docker/worker-cli/Dockerfile | |
context: docker/docker/worker-cli | |
steps: | |
- name: Run latest-tag | |
uses: EndBug/latest-tag@latest | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up SSH agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Save ssh private key file | |
run: echo "${{ secrets.SSH_PRIVATE_KEY }}" > deploy-ssh-key | |
- name: Build and push app image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
ssh: | | |
default=deploy-ssh-key | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.service }}:latest |