Build and push docker image #23
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 and push docker image | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update submodule | |
run: | | |
git submodule update --init --recursive | |
- name: Build images | |
run: | | |
docker compose build | |
working-directory: qhhoj | |
- name: Test images | |
run: | | |
./scripts/github_init | |
docker compose up -d | |
sleep 10 | |
COMPOSE_EXEC_FLAGS="-T" ./scripts/collectstatic | |
COMPOSE_EXEC_FLAGS="-T" ./scripts/migrate | |
COMPOSE_EXEC_FLAGS="-T" ./scripts/manage loaddata language_small | |
working-directory: qhhoj | |
- name: Push images to Docker | |
if: (github.event_name == 'push' || github.event_name == 'schedule') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') | |
run: | | |
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin | |
docker push qhhoj/qhhoj-base:latest | |
docker push qhhoj/qhhoj-pdfoid:latest | |
docker push qhhoj/qhhoj-site:latest | |
docker push qhhoj/qhhoj-celery:latest | |
docker push qhhoj/qhhoj-bridged:latest | |
docker push qhhoj/qhhoj-wsevent:latest | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |