Skip to content

Add dockerfiles

Add dockerfiles #8

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build Docker Images
runs-on: ubuntu-latest
steps:
- name: downcase REPO
id: lowercase
run: |
echo "REPO=$(GITHUB_REPOSITORY,,)" >> "${GITHUB_ENV}"
- name: Checkout
uses: actions/checkout@v2
- name: Get Version Tags
id: versions
run: |
echo "FRONTEND_VERSION=$(node -p "require('./frontend/package.json').version")" >> "$GITHUB_OUTPUT"
echo "BACKEND_VERSION=$(echo "$(<backend/api/routes.py)" | grep -oP "(?<=version=\")[^\"]+")" >> "$GITHUB_OUTPUT"
- name: Docker Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: npm
- name: npm build
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
cd frontend
npm install --legacy-peer-deps
npm ci --loglevel verbose --userconfig npmrc --max-old-space-size=16096 -legacy-peer-deps
npm run build --userconfig npmrc --max-old-space-size=16096
- name: Build & push frontend
uses: docker/build-push-action@v2
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: ghcr.io/${REPO}/frontend:latest-main, ghcr.io/${REPO}/frontend:${{ steps.versions.outputs.FRONTEND_VERSION }}-main
- name: Build & push backend
uses: docker/build-push-action@v2
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ghcr.io/${REPO}/backend:latest-main, ghcr.io/${REPO}/backend:${{ steps.versions.outputs.BACKEND_VERSION }}-main