File tree Expand file tree Collapse file tree 4 files changed +44
-29
lines changed Expand file tree Collapse file tree 4 files changed +44
-29
lines changed Original file line number Diff line number Diff line change @@ -20,3 +20,12 @@ services:
20
20
- 80:80
21
21
depends_on :
22
22
- docker-fastapi
23
+ web :
24
+ container_name : " web"
25
+ build :
26
+ context : .
27
+ dockerfile : ./docker/node/Dockerfile
28
+ ports :
29
+ - 3000:3000
30
+
31
+
Original file line number Diff line number Diff line change
1
+ FROM node:latest
2
+
3
+
4
+ WORKDIR /app
5
+
6
+ COPY ./frontend .
7
+ RUN npm install && npm run build
8
+ RUN npm install -g serve
9
+ CMD serve -s build
Original file line number Diff line number Diff line change 1
1
2
- FROM node:latest as build_frontend
3
-
4
-
5
- WORKDIR /app
6
-
7
- # COPY ./frontend/package.json ./frontend/package-lock.json /usr/src/app/
8
-
9
- COPY ./frontend .
10
- RUN npm install
11
-
12
- RUN npm run build
2
+ # FROM node:latest as build_frontend
3
+ #
4
+ #
5
+ # WORKDIR /app
6
+ #
7
+ # # COPY ./frontend/package.json ./frontend/package-lock.json /usr/src/app/
8
+ #
9
+ # COPY ./frontend .
10
+ # RUN npm install
11
+ #
12
+ # RUN npm run build
13
13
14
14
15
15
FROM nginx:latest
16
- RUN rm /usr/share/nginx/html/*
17
- COPY --from=build_frontend /app/build /usr/share/nginx/html
18
- RUN rm /etc/nginx/conf.d/default.conf
16
+ # RUN rm /usr/share/nginx/html/*
17
+ # COPY --from=build_frontend /app/build /usr/share/nginx/html
18
+ # RUN rm /etc/nginx/conf.d/default.conf
19
19
20
20
COPY ./docker/nginx/nginx.conf /etc/nginx/conf.d
21
21
EXPOSE 80
Original file line number Diff line number Diff line change 1
1
upstream docker_fastapi {
2
2
server docker-fastapi:8080;
3
3
}
4
+ upstream web {
5
+ server web:3000;
6
+ }
7
+
8
+
4
9
5
10
server {
6
11
listen 80 ;
7
-
8
- location ~ /api/ {
9
- proxy_pass http://docker_fastapi;
10
- proxy_set_header Host $host ;
11
- proxy_set_header X-Real-IP $remote_addr ;
12
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
13
- proxy_set_header X-Forwarded-Host $server_name ;
14
- }
12
+ server_name nginx;
13
+ proxy_set_header Host $host ;
14
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
15
+ proxy_set_header X-Real-IP $remote_addr ;
15
16
16
17
location / {
17
- root /usr/share/nginx/html;
18
- index index.html index.htm;
19
- try_files $uri $uri / /index.html;
18
+ proxy_pass http://web/;
20
19
}
21
20
22
- error_page 500 502 503 504 /50x.html;
23
-
24
- location = /50x.html {
25
- root /usr/share/nginx/html;
21
+ location /api/v1 {
22
+ proxy_pass http://fastapi_backend/api/v1;
26
23
}
27
24
}
You can’t perform that action at this time.
0 commit comments