Build docker images #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 docker images | |
on: | |
workflow_dispatch: | |
inputs: | |
SUPPORTED_PLATFORMS: | |
default: 'linux/amd64' | |
type: choice | |
options: | |
- 'linux/amd64' | |
- 'linux/amd64,linux/arm64' | |
IMAGE: | |
type: choice | |
options: | |
- 'base' | |
- 'common' | |
- 'snpeff' | |
- 'xengsort' | |
env: | |
REGISTRY: ${{ vars.REGISTRY }} | |
AWS_REGION: us-east-1 | |
DOCKERFILE: Dockerfile | |
jobs: | |
build: | |
runs-on: arc-runner | |
steps: | |
- name: Reset Docker credentials store | |
run: | | |
# Docker is configured to use the ecr credentials helper, | |
# which clashes with the aws-actions/configure-aws-credentials action. | |
rm -f ~/.docker/config.json | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to AWS ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Checkout out the source code | |
uses: actions/checkout@v4 | |
- name: Read the environment from the file | |
id: import-env | |
shell: bash | |
run: | | |
while read line; do | |
echo "$line" >> $GITHUB_ENV | |
done < resolwe_docker_images/${{ inputs.image }}/build.env | |
- name: Generate tags and labels | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/genialis/${{ env.REPOSITORY }} | |
flavor: | | |
latest=false | |
tags: | | |
type=raw,value=${{ env.TAG }} | |
labels: | | |
version: ${{ env.TAG }} | |
- name: Build the image | |
uses: docker/build-push-action@v5 | |
with: | |
context: resolwe_docker_images/${{ inputs.image }} | |
file: resolwe_docker_images/${{ inputs.image }}/${{ env.DOCKERFILE }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ env.SUPPORTED_PLATFORMS }} | |
build-args: | | |
BASE_IMAGE=${{ env.BASE_IMAGE }} | |
push: true |