Skip to content

Multi arch matrix pipeline #76

Multi arch matrix pipeline

Multi arch matrix pipeline #76

Workflow file for this run

name: Docker - v2 current
on:
pull_request:
paths:
- .github/workflows/v2-current.yaml
- '2.7/**'
push:
branches:
- main
paths:
- .github/workflows/v2-current.yaml
- '2.7/**'
env:
AWS_REGION: us-east-1
ECR_REPO: public.ecr.aws/u0u1j5s3/composer
jobs:
build-latest:
name: Build latest version
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
version:
- "2.7"
steps:
- uses: actions/checkout@v4
- name: "Determine composer version from Dockerfile"
uses: "./.github/actions/determine-composer-version"
with:
working-directory: "${{ matrix.version }}"
# Build full image: binary with runtime
- name: Build full image
working-directory: ${{ matrix.version }}
run: |
docker build \
--pull \
--no-cache \
--target binary-with-runtime \
--tag composer/composer:latest \
--tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} \
--tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} \
--tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} \
.
# Build low-size image with binary only
- name: Build binary-only image
working-directory: ${{ matrix.version }}
run: |
docker build \
--pull \
--no-cache \
--target standalone-binary \
--tag composer/composer:latest-bin \
--tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin \
--tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin \
--tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin \
.
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push tag(s) to Docker Hub
if: github.ref == 'refs/heads/main'
working-directory: ${{ matrix.version }}
run: |
docker push composer/composer:latest
docker push composer/composer:latest-bin
docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}
docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin
docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}
docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin
docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}
docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin
- name: Login to Amazon Public ECR
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_ECR_ACCESS_KEY }}
password: ${{ secrets.AWS_ECR_SECRET_KEY }}
- name: Push tag(s) to Amazon Public ECR
if: github.ref == 'refs/heads/main'
working-directory: ${{ matrix.version }}
run: |
docker tag composer/composer:latest ${{ env.ECR_REPO }}:latest
docker tag composer/composer:latest-bin ${{ env.ECR_REPO }}:latest-bin
docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}
docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}-bin
docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}
docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin
docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}
docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin
docker push ${{ env.ECR_REPO }}:latest
docker push ${{ env.ECR_REPO }}:latest-bin
docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}
docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}-bin
docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}
docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin
docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}
docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin