Skip to content

conf: Handle docker multiarchitecture #2

conf: Handle docker multiarchitecture

conf: Handle docker multiarchitecture #2

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- develop
- main
tags:
- "*.*.*"
pull_request:
branches:
- develop
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create Docker Buildx Builder
run: |
docker buildx create --name mybuilder --use
docker buildx inspect --bootstrap
- name: Build and Push Docker Image (Develop)
if: github.ref == 'refs/heads/develop'
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
-t ${{ secrets.DOCKER_USERNAME }}/status-frontend:develop .
- name: Build and Push Docker Image (Version Tags)
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=$(echo "${GITHUB_REF#refs/tags/}")
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
-t ${{ secrets.DOCKER_USERNAME }}/status-frontend:$TAG .
- name: Build and Push Docker Image for Pull Request
if: github.event_name == 'pull_request'
run: |
PR_ID=${{ github.event.pull_request.number }}
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
-t ${{ secrets.DOCKER_USERNAME }}/status-frontend:PR.$PR_ID .