Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/workflows/deploy-containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Publish GHCR Images

on:
workflow_dispatch:

concurrency:
group: publish-ghcr-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io

jobs:
build-and-push-backend:
runs-on: ubuntu-latest
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4

- name: Compute image prefix
id: meta
run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check: is it correct to use ,, (two commas)?


- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push backend image
id: build
uses: docker/build-push-action@v6
with:
context: ./backend
push: true
tags: |
${{ steps.meta.outputs.prefix }}/dashboard-backend:latest
${{ steps.meta.outputs.prefix }}/dashboard-backend:${{ github.sha }}

build-and-push-dashboard:
runs-on: ubuntu-latest
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4

- name: Compute image prefix
id: meta
run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push dashboard image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./dashboard/Dockerfile
push: true
tags: |
${{ steps.meta.outputs.prefix }}/dashboard-frontend:latest
${{ steps.meta.outputs.prefix }}/dashboard-frontend:${{ github.sha }}

build-and-push-proxy:
runs-on: ubuntu-latest
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4

- name: Compute image prefix
id: meta
run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push proxy image
id: build
uses: docker/build-push-action@v6
with:
context: ./proxy
push: true
tags: |
${{ steps.meta.outputs.prefix }}/dashboard-proxy:latest
${{ steps.meta.outputs.prefix }}/dashboard-proxy:${{ github.sha }}

verify:
if: always()
needs:
- build-and-push-backend
- build-and-push-dashboard
- build-and-push-proxy
runs-on: ubuntu-latest
steps:
- name: Image publish summary
run: |
echo "### Published GHCR Images" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Image | Digest |" >> "$GITHUB_STEP_SUMMARY"
echo "| ----- | ------ |" >> "$GITHUB_STEP_SUMMARY"
echo "| dashboard-backend | \`${{ needs.build-and-push-backend.outputs.digest }}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| dashboard-frontend | \`${{ needs.build-and-push-dashboard.outputs.digest }}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| dashboard-proxy | \`${{ needs.build-and-push-proxy.outputs.digest }}\` |" >> "$GITHUB_STEP_SUMMARY"
5 changes: 5 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__
.pytest_cache
*.pyc

tests_submissions
5 changes: 0 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ RUN O='0 1 2' \
PYTHONOPTIMIZE=$N poetry run python -m compileall -q $D || exit 1; \
done

ARG BACKEND_VOLUME_DIR
ENV BACKEND_VOLUME_DIR=${BACKEND_VOLUME_DIR}
RUN echo "Building with volume on: $BACKEND_VOLUME_DIR"
VOLUME ${BACKEND_VOLUME_DIR}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this affect our old composes? Including the composes for the other parts of the project


# Expose both application and metrics ports
EXPOSE 8000 8001

Expand Down
74 changes: 74 additions & 0 deletions docker-compose-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
volumes:
backend-data:
runtime-data:
static-data:
dashboard-db-data:

networks:
public:
private:

services:
dashboard_db:
image: postgres:17
env_file:
- .env.db
volumes:
- dashboard-db-data:/var/lib/postgresql/data
networks:
- private
ports:
- "5434:5432"

redis:
image: redis:8.0-M04-alpine
restart: always
networks:
- private
ports:
- 6379:6379

backend:
image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER}/${IMAGE_REPOSITORY}/dashboard-backend:${IMAGE_TAG}
volumes:
- backend-data:${BACKEND_VOLUME_DIR:-/volume_data}
restart: always
networks:
- private
- public
ports:
- target: 8000
published: 8000
protocol: tcp
- target: 8001
published: 8001
protocol: tcp
depends_on:
- redis
- dashboard_db
env_file:
- .env.backend
environment:
DB_DEFAULT_HOST: ${DB_DEFAULT_HOST:-dashboard_db}

dashboard:
image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER}/${IMAGE_REPOSITORY}/dashboard-frontend:${IMAGE_TAG}
volumes:
- static-data:/data/static

proxy:
image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER}/${IMAGE_REPOSITORY}/dashboard-proxy:${IMAGE_TAG}
restart: always
depends_on:
- backend
- dashboard
networks:
- public
volumes:
- static-data:/data/static
ports:
- target: 80
published: 80
protocol: tcp
env_file:
- .env.proxy
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ services:
context: ./backend
args:
BACKEND_VOLUME_DIR: ${BACKEND_VOLUME_DIR:-/volume_data}
image: ghcr.io/${IMAGE_NAME:-local}/backend:latest
volumes:
- backend-data:${BACKEND_VOLUME_DIR:-/volume_data}
restart: always
Expand Down Expand Up @@ -78,12 +79,13 @@ services:
build:
context: .
dockerfile: ./dashboard/Dockerfile
image: dashboard:latest
image: ghcr.io/${IMAGE_NAME:-local}/dashboard:latest
volumes:
- static-data:/data/static

proxy:
build: ./proxy
image: ghcr.io/${IMAGE_NAME:-local}/proxy:latest
restart: always
depends_on:
- backend
Expand Down