Add Platform container deployment

This commit is contained in:
2026-08-15 20:32:44 +03:00
parent adff766f87
commit cda86ded5f
4 changed files with 121 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
COPY platform/backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY platform/backend/ .
RUN useradd --create-home --uid 1001 appuser \
&& mkdir -p /data \
&& chown -R appuser:appuser /app /data
USER appuser
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
+56
View File
@@ -0,0 +1,56 @@
services:
platform-backend:
build:
context: ..
dockerfile: deploy/platform-backend.Dockerfile
restart: unless-stopped
environment:
APP_NAME: Platform
APP_VERSION: 1.0.0
APP_DEBUG: "false"
APP_CORS_ORIGINS: "http://192.168.1.35"
DATABASE_URL: "sqlite:////data/platform.db"
JWT_SECRET_KEY: "CHANGE_ME_PLATFORM_JWT_SECRET"
JWT_ALGORITHM: "HS256"
JWT_ACCESS_TOKEN_EXPIRE_MINUTES: "480"
volumes:
- platform_data:/data
expose:
- "8000"
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/health')"
]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
platform-frontend:
build:
context: ..
dockerfile: deploy/platform-frontend.Dockerfile
restart: unless-stopped
depends_on:
platform-backend:
condition: service_healthy
ports:
- "80:80"
volumes:
platform_data:
+22
View File
@@ -0,0 +1,22 @@
FROM node:22-alpine AS build
WORKDIR /app
COPY platform/frontend/package.json platform/frontend/package-lock.json ./
RUN npm ci
COPY platform/frontend/ .
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY deploy/platform-nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+21
View File
@@ -0,0 +1,21 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location /api/ {
proxy_pass http://platform-backend:8000;
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;
}
location / {
try_files $uri $uri/ /index.html;
}
}