Workflow file for this run
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 Images | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build and push frontend images | |
- name: Build and push frontend Docker images | |
run: | | |
cd ./frontend/ | |
docker-compose build | |
docker tag dps_training_k-frontend ghcr.io/hpi-sam/dps_training_k-frontend:latest | |
docker push ghcr.io/hpi-sam/dps_training_k-frontend:latest | |
# Build and push backend images | |
- name: Build and push backend Docker images | |
run: | | |
cd ./backend/dps_training_k/ | |
docker-compose build | |
docker tag dps_training_k-django ghcr.io/hpi-sam/dps_training_k-django:latest | |
docker push ghcr.io/hpi-sam/dps_training_k-django:latest | |
docker tag dps_training_k-celeryworker ghcr.io/hpi-sam/dps_training_k-celeryworker:latest | |
docker push ghcr.io/hpi-sam/dps_training_k-celeryworker:latest | |
docker tag dps_training_k-celerybeat ghcr.io/hpi-sam/dps_training_k-celerybeat:latest | |
docker push ghcr.io/hpi-sam/dps_training_k-celerybeat:latest | |
docker tag dps_training_k-nginx ghcr.io/hpi-sam/dps_training_k-nginx:latest | |
docker push ghcr.io/hpi-sam/dps_training_k-nginx:latest | |
docker tag dps_training_k-postgres ghcr.io/hpi-sam/dps_training_k-postgres:latest | |
docker push ghcr.io/hpi-sam/dps_training_k-postgres:latest | |
# Skip redis as it is just the public Docker Hub image anyway and therefore should be directly pulled from there | |
- name: Prepare deployment files | |
run: | | |
mkdir deployment_files | |
cp docker-compose.yml deployment_files/ | |
cp frontend/env.d.ts deployment_files/ | |
cp backend/dps_training_k/.env deployment_files/ | |
- name: Archive deployment files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: deployment-files | |
path: deployment_files/ |