-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (64 loc) · 1.63 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
name: Docker Image CI
on:
pull_request:
branches:
- main
- dev
jobs:
build:
runs-on: ubuntu-latest
services:
db:
image: neo4j:5.12.0
env_file:
- db/credentials.env
ports:
- 7474:7474
- 7687:7687
volumes:
- ./db/data:/data
- ./db/conf:/conf
frontend:
build: ./frontend
ports:
- 5173:80
backend:
build: ./backend
ports:
- 5000:5000
depends_on:
- db
command: sh -c "/wait && npm run prod"
environment:
- NEO4J_URI=neo4j://db:7687
- WAIT_HOSTS=db:7474
- WAIT_BEFORE_HOSTS=15
- WAIT_AFTER_HOSTS=3
steps:
- uses: actions/checkout@v3
# - uses: isbang/[email protected]
# with:
# compose-file: "compose.yml"
# services: |
# db
# frontend
# backend
# - name: Create .env file
# run: touch db/credentials.env
# - name: Add login passes to env file
# run: echo "NEO4J_AUTH=neo4j/admin123" >> db/credentials.env
# - name: Run Docker compose
# run: docker-compose up -d
- name: List containers
run: sleep 2; docker ps
- name: Wait for containers to start
run: |
sleep 15
docker run \
--rm \
--network mercury-project_default \
alpine/curl -o /dev/null --retry 3 --retry-connrefused backend:5000
- name: Test the backend
run: cd backend; npm i && npm run test run
- name: Shut down Docker compose
run: cd ..; docker-compose down