Skip to content

Containers: Publish #14

Containers: Publish

Containers: Publish #14

name: 'Containers: Publish'
on:
push:
tags:
- 'v*'
permissions:
packages: write
jobs:
release-containers:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Frontend Dependencies & Build
run: |
cd frontend
npm ci
npm run build
cd ..
- name: Login to ghcr.io Docker registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute Docker container image addresses
run: |
DOCKER_REPOSITORY="ghcr.io/${GITHUB_REPOSITORY,,}"
DOCKER_TAG="${GITHUB_REF:11}"
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
echo "Using: ${DOCKER_REPOSITORY}/*:${DOCKER_TAG}"
- name: "Build Docker container image: backend:latest"
run: |
cd server
docker build \
--file Dockerfile.prod \
--tag "${DOCKER_REPOSITORY}/backend:${DOCKER_TAG}" \
.
cd ..
- name: Push Docker container image backend:${DOCKER_TAG}
run: docker push "${DOCKER_REPOSITORY}/backend:${DOCKER_TAG}"