Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

fix: Docker multi-arch images push for linux/amd64, linux/arm64 (#4006) #28

fix: Docker multi-arch images push for linux/amd64, linux/arm64 (#4006)

fix: Docker multi-arch images push for linux/amd64, linux/arm64 (#4006) #28

name: Build and Push Docker Images
on:
push:
branches:
- master
- open-release/**
jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# Use the release name as the image tag if we're building an open release tag.
# Examples: if we're building 'open-release/olive.master', tag the image as 'olive.master'.
# Otherwise, we must be building from a push to master, so use 'latest'.
- name: Get tag name
id: get-tag-name
uses: actions/github-script@v5
with:
script: |
const branchName = context.ref.split('/').slice(-1)[0];
const tagName = branchName === 'master' ? 'latest' : branchName;
console.log('Will use tag: ' + tagName);
return tagName;
result-encoding: string
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Dev Docker image
uses: docker/build-push-action@v4
with:
push: true
target: dev
repository: edxops/ecommerce-dev
tags: |
edxops/ecommerce-dev:${{ steps.get-tag-name.outputs.result }}
edxops/ecommerce-dev:${{ github.sha }}
platforms: linux/amd64,linux/arm64
# The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get
# suitable images for smaller prod environments.
# - name: Build and push prod Docker image
# uses: docker/build-push-action@v4
# with:
# push: true
# target: prod
# repository: edxops/ecommerce-prod
# tags: |
# edxops/ecommerce-prod:${{ steps.get-tag-name.outputs.result }}
# edxops/ecommerce-prod:${{ github.sha }}
# platforms: linux/amd64,linux/arm64