Skip to content

Commit

Permalink
Merge pull request #90 from cthit/workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GAsplund authored Nov 6, 2023
2 parents 7f2a4f2 + d08e669 commit 7995fdf
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 3 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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
50 changes: 50 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
push:
branches: [main]
pull_request:
branches: [main]

name: "Frontend 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: frontend
- name: Build
run: npm run build
working-directory: frontend

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: ./frontend
file: ./frontend/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: ghcr.io/cthit/bookit-node-frontend:latest
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:lts as build
FROM node:16 as build

COPY package.json package-lock.json ./
COPY ./prisma/ .
Expand All @@ -7,7 +7,7 @@ RUN npm install
COPY . .
RUN npm run build

FROM node:lts
FROM node:16

COPY --from=build ./build ./build/
COPY --from=build ./src/schemas ./build/schemas
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:lts as build
FROM node:16 as build

COPY package.json package-lock.json ./

Expand Down

0 comments on commit 7995fdf

Please sign in to comment.