add docker prod build files
This commit is contained in:
19
.build/prod/app.Dockerfile
Normal file
19
.build/prod/app.Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM node:20-slim AS frontendbuilder
|
||||
|
||||
WORKDIR /tmp/frontendbuilder
|
||||
COPY public/ .
|
||||
RUN npm ci && npm run build
|
||||
|
||||
|
||||
FROM python:3.11.4-slim-buster
|
||||
|
||||
WORKDIR /var/www/html/
|
||||
COPY . .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY --from=frontendbuilder /tmp/frontendbuilder/dist/ /var/www/html/public
|
||||
|
||||
VOLUME /var/www/html/public
|
||||
|
||||
CMD uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
13
.build/prod/compose.yml
Normal file
13
.build/prod/compose.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ../../
|
||||
dockerfile: .build/prod/app.Dockerfile
|
||||
hostname: mapmaker
|
||||
image: git.shihaam.dev/sarlink/mapmaker/api
|
||||
nginx:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./nginx.Dockerfile
|
||||
hostname: mapmaker-nginx
|
||||
image: git.shihaam.dev/sarlink/mapmaker/nginx
|
||||
@@ -6,7 +6,7 @@ server {
|
||||
error_log /dev/stdout info;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://api:8000/api/;
|
||||
proxy_pass http://mapmaker:8000/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
@@ -15,7 +15,7 @@ server {
|
||||
}
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://api:8000/ws/;
|
||||
proxy_pass http://mapmaker:8000/ws/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
@@ -23,22 +23,19 @@ server {
|
||||
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;
|
||||
|
||||
# WebSocket timeout settings
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 86400s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
location / {
|
||||
# In development, proxy to Vite dev server
|
||||
proxy_pass http://node:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
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;
|
||||
root /var/www/html/public;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM node:24-bookworm-slim
|
||||
|
||||
WORKDIR /var/www/html/public
|
||||
|
||||
CMD npm run dev -- --host 0.0.0.0
|
||||
@@ -1,7 +0,0 @@
|
||||
FROM python:3.11.4-slim-buster
|
||||
|
||||
WORKDIR /var/www/html/
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
Reference in New Issue
Block a user