Skip to content

Build Docker Images #506

Build Docker Images

Build Docker Images #506

Workflow file for this run

name: Build Docker Images
on:
push:
branches:
- 'master'
paths:
- 'dmoj/**'
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Every day at midnight
jobs:
build:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: fetch repo
uses: actions/checkout@v4
with:
repository: 'mcpt/wlmoj'
path: 'dmoj/repo'
- name: Setup submodules
run: git submodule update --init --recursive
working-directory: dmoj/repo
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images
run: docker buildx bake --file docker-build.yml --file ../docker-build-cache.json
working-directory: dmoj
- name: Test images
id: test
run: |
./scripts/initialize
docker compose -f docker-build.yml up -d
docker ps -a
sleep 15
export COMPOSE_EXEC_FLAGS="-T"
export COMPOSE_FLAGS="-f docker-build.yml"
./scripts/copy_static
./scripts/migrate
./scripts/manage loaddata language_small
working-directory: dmoj
- name: Log Failures
if: ${{ failure() && steps.test.conclusion == 'failure' }}
run: |
docker compose -f docker-build.yml logs
working-directory: dmoj
- name: Push images to GHCR
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
run: |
docker push ghcr.io/mcpt/wlmoj-base:latest
docker push ghcr.io/mcpt/wlmoj-pdfoid:latest
docker push ghcr.io/mcpt/wlmoj-site:latest
docker push ghcr.io/mcpt/wlmoj-nginx:latest
docker push ghcr.io/mcpt/wlmoj-mathoid:latest
docker push ghcr.io/mcpt/wlmoj-texoid:latest
docker push ghcr.io/mcpt/wlmoj-celery:latest
docker push ghcr.io/mcpt/wlmoj-bridged:latest
docker push ghcr.io/mcpt/wlmoj-wsevent:latest