add missed files
This commit is contained in:
15
frontend/Dockerfile
Normal file
15
frontend/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
# Этап 1: сборка React-приложения.
|
||||
# VITE_API_URL не задаем: фронт ходит на относительный /api,
|
||||
# который этот же nginx проксирует в бэкенд (см. nginx.conf).
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package.json ./
|
||||
RUN npm install
|
||||
COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
# Этап 2: раздача статики + прокси API.
|
||||
FROM nginx:1.27-alpine
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
28
frontend/nginx.conf
Normal file
28
frontend/nginx.conf
Normal file
@@ -0,0 +1,28 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# API бэкенда (Spring Boot в compose-сервисе client-backend)
|
||||
location /api/ {
|
||||
proxy_pass http://client-backend:8181;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Swagger UI бэкенда (удобно на первое время, потом можно закрыть)
|
||||
location /swagger-ui/ {
|
||||
proxy_pass http://client-backend:8181;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
location /v3/api-docs {
|
||||
proxy_pass http://client-backend:8181;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# Статика React SPA
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
||||
1792
frontend/package-lock.json
generated
Normal file
1792
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user