Skip to content

Add CI workflows and make docker build #5

Add CI workflows and make docker build

Add CI workflows and make docker build #5

Workflow file for this run

on:
push:
branches: [main]
pull_request:
branches: [main]
name: "Backend CI"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- name: Install dependencies
run: npm install
working-directory: backend
- name: Build
run: npm run build
working-directory: backend
docker:
runs-on: ubuntu-latest
needs:
- build
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./backend
file: ./backend/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: ghcr.io/cthit/bookit-node-backend:latest