Skip to content

Docker Image CI

Docker Image CI #13

Workflow file for this run

name: Docker Image CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
schedule:
- cron: "0 4 * * sun"
env:
TEST_CONTAINER_TAG: "ghcr.io/${{github.repository}}:${{github.sha}}"
RELEASE_CONTAINER_TAG: "ghcr.io/${{github.repository}}:latest"
jobs:
build_test:
name: Build Test Container
runs-on: ubuntu-latest
steps:
- name: Login to Registry
run: >-
echo "${{ secrets.GITHUB_TOKEN }}"
| docker login ghcr.io -u $ --password-stdin
- name: Checkout
uses: actions/checkout@v4
- name: Build Test Container
# in bash, `${ENVIRONMENT_VARIABLE,,}` lowercases whatever is stored in `ENVIRONMENT_VARIABLE`
run: >-
docker build
--pull
--build-arg CORES="$(nproc)"
--tag "${TEST_CONTAINER_TAG,,}"
${{github.workspace}}
- name: Push Test Container
run: >-
docker push "${TEST_CONTAINER_TAG,,}"
- name: Push Latest Tag
if: ${{github.ref_name == 'main'}}
run: |
docker pull "${TEST_CONTAINER_TAG,,}"
docker tag "${TEST_CONTAINER_TAG,,}" "${RELEASE_CONTAINER_TAG,,}"
docker push "${RELEASE_CONTAINER_TAG,,}"