Skip to content

Commit 59c9784

Browse files
DuGuYifeiSelich
andauthored
ci: Add docker configuration (#3)
* ci: Add docker configuration * chore: Update nginx base image to 1.27-alpine in frontend --------- Co-authored-by: Nikola Selic <selich.work@gmail.com>
1 parent a5a099c commit 59c9784

File tree

13 files changed

+241
-0
lines changed

13 files changed

+241
-0
lines changed

docker-compose.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
version: '3.8'
2+
3+
services:
4+
# Frontend services
5+
frontend:
6+
build:
7+
context: ./frontend
8+
dockerfile: Dockerfile
9+
expose:
10+
- "80"
11+
depends_on:
12+
- service-gateway
13+
networks:
14+
- frontend-network
15+
- backend-network
16+
17+
# Gateway service
18+
service-gateway:
19+
build:
20+
context: ./service-gateway
21+
dockerfile: Dockerfile
22+
ports:
23+
- "8080:8080"
24+
depends_on:
25+
- service-job
26+
- service-application
27+
- service-assess
28+
- service-genai
29+
networks:
30+
- backend-network
31+
environment:
32+
- SPRING_PROFILES_ACTIVE=docker
33+
34+
# Job service
35+
service-job:
36+
build:
37+
context: ./service-job
38+
dockerfile: Dockerfile
39+
expose:
40+
- "8080"
41+
depends_on:
42+
- postgres
43+
networks:
44+
- backend-network
45+
environment:
46+
- SPRING_PROFILES_ACTIVE=docker
47+
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hrapp
48+
- SPRING_DATASOURCE_USERNAME=postgres
49+
- SPRING_DATASOURCE_PASSWORD=postgres
50+
51+
# Application service
52+
service-application:
53+
build:
54+
context: ./service-application
55+
dockerfile: Dockerfile
56+
expose:
57+
- "8080"
58+
depends_on:
59+
- postgres
60+
networks:
61+
- backend-network
62+
environment:
63+
- SPRING_PROFILES_ACTIVE=docker
64+
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hrapp
65+
- SPRING_DATASOURCE_USERNAME=postgres
66+
- SPRING_DATASOURCE_PASSWORD=postgres
67+
68+
# Assessment service
69+
service-assess:
70+
build:
71+
context: ./service-assess
72+
dockerfile: Dockerfile
73+
expose:
74+
- "8080"
75+
depends_on:
76+
- postgres
77+
networks:
78+
- backend-network
79+
environment:
80+
- SPRING_PROFILES_ACTIVE=docker
81+
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hrapp
82+
- SPRING_DATASOURCE_USERNAME=postgres
83+
- SPRING_DATASOURCE_PASSWORD=postgres
84+
85+
# GenAI Python service
86+
service-genai:
87+
build:
88+
context: ./service-genai
89+
dockerfile: Dockerfile
90+
expose:
91+
- "8080"
92+
depends_on:
93+
- postgres
94+
networks:
95+
- backend-network
96+
environment:
97+
- POSTGRES_HOST=postgres
98+
- POSTGRES_PORT=5432
99+
- POSTGRES_USER=postgres
100+
- POSTGRES_PASSWORD=postgres
101+
- POSTGRES_DB=hrapp
102+
103+
# PostgreSQL with pgvector
104+
postgres:
105+
image: pgvector:0.8.0-pg17
106+
volumes:
107+
- postgres-data:/var/lib/postgresql/data
108+
- ./postgresql/init.sql:/docker-entrypoint-initdb.d/init.sql
109+
environment:
110+
- POSTGRES_USER=postgres
111+
- POSTGRES_PASSWORD=postgres
112+
- POSTGRES_DB=hrapp
113+
expose:
114+
- "5432"
115+
networks:
116+
- backend-network
117+
118+
networks:
119+
frontend-network:
120+
driver: bridge
121+
backend-network:
122+
driver: bridge
123+
124+
volumes:
125+
postgres-data:
126+
driver: local

frontend/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:22.16.0-bullseye-slim AS builder
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
RUN npm install
7+
8+
COPY . .
9+
RUN npm run build
10+
11+
FROM nginx:1.27-alpine
12+
13+
COPY --from=builder /app/build /usr/share/nginx/html
14+
COPY nginx.conf /etc/nginx/conf.d/default.conf
15+
16+
EXPOSE 80
17+
18+
CMD ["nginx", "-g", "daemon off;"]

frontend/nginx.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
try_files $uri $uri/ /index.html;
8+
}
9+
}

genai/.gitkeep

Whitespace-only changes.

postgresql/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM pgvector:0.8.0-pg16
2+
3+
# Copy initialization scripts
4+
COPY ./init.sql /docker-entrypoint-initdb.d/
5+
6+
EXPOSE 5432
File renamed without changes.

server/.gitkeep

Whitespace-only changes.

service-application/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM eclipse-temurin:21-jdk AS builder
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
RUN ./gradlew build -x test
7+
8+
FROM eclipse-temurin:21-jre
9+
10+
WORKDIR /app
11+
12+
COPY --from=builder /app/build/libs/*.jar app.jar
13+
14+
EXPOSE 8080
15+
16+
ENTRYPOINT ["java", "-jar", "app.jar"]

service-assess/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM eclipse-temurin:21-jdk AS builder
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
RUN ./gradlew build -x test
7+
8+
FROM eclipse-temurin:21-jre
9+
10+
WORKDIR /app
11+
12+
COPY --from=builder /app/build/libs/*.jar app.jar
13+
14+
EXPOSE 8080
15+
16+
ENTRYPOINT ["java", "-jar", "app.jar"]

service-gateway/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM eclipse-temurin:21-jdk AS builder
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
RUN ./gradlew build -x test
7+
8+
FROM eclipse-temurin:21-jre
9+
10+
WORKDIR /app
11+
12+
COPY --from=builder /app/build/libs/*.jar app.jar
13+
14+
EXPOSE 8080
15+
16+
ENTRYPOINT ["java", "-jar", "app.jar"]

0 commit comments

Comments
 (0)