Skip to content

Deploy

Deploy #170

Workflow file for this run

name: Deploy
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@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push frontend Docker images
run: |
cd ./frontend/
docker compose --env-file .env.prod 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
- name: Build and push backend Docker images
run: |
cd ./backend/dps_training_k/
docker compose --env-file .env.prod 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.prod.yml deployment_files/docker-compose.prod.yml
cp docker-compose.dev.yml deployment_files/docker-compose.dev.yml
cp .env.prod deployment_files/.env.prod
cp .env.dev deployment_files/.env.dev
cp backend/dps_training_k/deployment/nginx/nginx_deploy_prod.conf deployment_files/nginx_prod.conf
cp backend/dps_training_k/deployment/nginx/nginx_deploy_dev.conf deployment_files/nginx_dev.conf
- name: Archive deployment files
uses: actions/upload-artifact@v4
with:
name: deployment-files
path: deployment_files/