Skip to content

Commit bcb0f54

Browse files
committed
new deploy test
1 parent 39fad70 commit bcb0f54

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
backend:
3+
build:
4+
context: ../../../server
5+
dockerfile: Dockerfile
6+
environment:
7+
- SESSION_SECRET=github-docker-ci-secret-doesnt-matter
8+
expose:
9+
- 5000
10+
networks:
11+
- app-network
12+
13+
frontend:
14+
build:
15+
context: ../../../frontend
16+
dockerfile: Dockerfile
17+
ports:
18+
- 3000:80
19+
depends_on:
20+
- backend
21+
networks:
22+
- app-network
23+
24+
networks:
25+
app-network:
26+
driver: bridge

.github/workflows/deploy.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,27 @@ jobs:
2121
username: ${{ secrets.DOCKERHUB_USERNAME }}
2222
password: ${{ secrets.DOCKERHUB_TOKEN }}
2323

24-
- name: Build and Test Backend
25-
working-directory: ./server
24+
- name: Build and Test images
25+
working-directory: .github/workflows/deploy-compose
2626
run: |
27-
docker build -t vizigr0u/anavlad-backend:${GITHUB_REF_NAME} .
28-
echo running server
29-
docker run -d -p 5000:5000 --name backend-test vizigr0u/anavlad-backend:${GITHUB_REF_NAME}
27+
docker compose up --build
3028
echo waiting 10 sec
31-
sleep 10 # Wait for server to start
32-
echo try to get /health
29+
sleep 10
30+
echo try to reach backend
3331
curl --retry 3 --retry-delay 5 --fail http://localhost:5000/api/health
32+
echo trying to reach frontend
33+
curl --retry 3 --retry-delay 5 --fail http://localhost:80
34+
docker compose down
3435
35-
- name: Build and Test Frontend
36+
- name: Build Frontend
3637
working-directory: ./frontend
3738
run: |
3839
docker build -t vizigr0u/anavlad-frontend:${GITHUB_REF_NAME} .
39-
echo running frontend
40-
docker run -d -p 80:80 --name frontend-test vizigr0u/anavlad-frontend:${GITHUB_REF_NAME}
41-
echo waiting 5 sec
42-
sleep 5
43-
echo trying to connect to frontend
44-
curl --retry 3 --retry-delay 5 --fail http://localhost:80
45-
echo stopping frontend
46-
docker stop frontend-test
47-
echo stopping backend
48-
docker stop backend-test
40+
41+
- name: Build Backend
42+
working-directory: ./backend
43+
run: |
44+
docker build -t vizigr0u/anavlad-backend:${GITHUB_REF_NAME} .
4945
5046
- name: Push Docker Images
5147
run: |

0 commit comments

Comments
 (0)