Commit 2958718e authored by Kantz's avatar Kantz
Browse files

nginx setup

parent 22db3d83
services:
nginx:
image: nginx:1.27-alpine
depends_on:
- backend
- frontend
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- frontend-dist:/usr/share/nginx/html:ro
restart: unless-stopped
backend:
build:
context: ../backend
dockerfile: Dockerfile
env_file:
- ../backend/.env
- ../backend/.env_openai
expose:
- "8000"
healthcheck:
......@@ -34,6 +22,8 @@ services:
restart: unless-stopped
volumes:
- ./logs:/app/logs
networks:
- web
frontend:
build:
......@@ -41,9 +31,10 @@ services:
dockerfile: Dockerfile
depends_on:
- backend
volumes:
- frontend-dist:/dist
restart: unless-stopped
networks:
- web
volumes:
frontend-dist:
networks:
web:
external: true
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://backend:8000/api/;
proxy_http_version 1.1;
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;
}
}
FROM node:22-alpine AS build
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
......@@ -10,10 +9,6 @@ RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build
FROM alpine:3.20
WORKDIR /app
COPY --from=build /app/dist ./dist
CMD ["sh", "-c", "mkdir -p /dist && cp -r /app/dist/. /dist/ && tail -f /dev/null"]
FROM nginx:1.27-alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
server {
listen 3000;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment