-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (83 loc) · 2.55 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Generate Docker Containers
on:
push:
tags:
- '*'
jobs:
database:
name: Build backend database
runs-on: ubuntu-latest
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5555/postgres"
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Start database
working-directory: backend
run: |
docker run -d \
--name my-db \
-p 5555:5432 \
-e PGDATA=/data \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=postgres \
postgres:16
- name: Init DB with prisma
working-directory: backend
run: npx prisma migrate dev --name init
- name: Seed DB with data
working-directory: backend
run: npm run seed
- name: Commit current state of the container
working-directory: backend
run: docker commit my-db daemontus/bbm-database:latest
- name: Push image
working-directory: backend
run: docker push daemontus/bbm-database
backend:
name: Build backend image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image
working-directory: backend
run: docker build -t daemontus/bbm-backend .
- name: Push image
working-directory: backend
run: docker push daemontus/bbm-backend
frontend:
name: Build frontend image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Add Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Install dependencies
working-directory: frontend
run: npm install
- name: Build frontend
working-directory: frontend
run: npm run build
- name: Build image
working-directory: frontend
run: docker build -t daemontus/bbm-frontend .
- name: Push image
working-directory: frontend
run: docker push daemontus/bbm-frontend