Skip to content

Docker and Actions Creations #6

Docker and Actions Creations

Docker and Actions Creations #6

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Docker Build
# Controls when the action will run.
on:
release:
types: [released]
pull_request:
branches:
- 'master'
- 'dev'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
env:
# Setting the defaults up front
LATEST_NODE: 16
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 18]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
-
name: Checkout
uses: actions/checkout@v3
- name: Show Env
run: env
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=auto
suffix=-${{matrix.node}}
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{raw}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
-
name: Setup QEMU
uses: docker/setup-qemu-action@v2
-
name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Get Date
id: date
run: echo "dateval=$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
id: build-push
uses: docker/build-push-action@v3
continue-on-error: true
with:
context: .
platforms: linux/amd64, linux/arm64, linux/armhf
file: docker/Dockerfile
build-args: |
NODE_VERSION=${{ matrix.node }}
BUILD_DATE=${{ env.dateval }}
BUILD_REF=${{ github.ref_name }}
CONTEST_DASHBOARD_VERSION=${{ steps.meta.outpus.tags }}
TAG_SUFFIX=${{ github.ref_type }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}