File tree Expand file tree Collapse file tree 4 files changed +29
-43
lines changed Expand file tree Collapse file tree 4 files changed +29
-43
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,4 @@ 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/frontend/Dockerfile
28
- ports :
29
- - 3000:3000
30
-
31
23
Load Diff This file was deleted.
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
-
9
4
10
5
server {
11
6
listen 80 ;
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 ;
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
+ }
16
15
17
16
location / {
18
- proxy_pass http://web/;
17
+ root /usr/share/nginx/html;
18
+ index index.html index.htm;
19
+ try_files $uri $uri / /index.html;
19
20
}
20
21
21
- location /api/v1 {
22
- proxy_pass http://fastapi_backend/api/v1;
22
+ error_page 500 502 503 504 /50x.html;
23
+
24
+ location = /50x.html {
25
+ root /usr/share/nginx/html;
23
26
}
24
27
}
You can’t perform that action at this time.
0 commit comments