docker-compose pre prod (non final)
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
.git
|
||||||
|
.venv
|
||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
|
.pytest_cache
|
||||||
|
.idea
|
||||||
|
.devcontainer
|
||||||
|
frontend
|
||||||
|
*.db
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
docker-compose*.yaml
|
||||||
@@ -6,4 +6,7 @@ __pycache__/
|
|||||||
frontend/node_modules/
|
frontend/node_modules/
|
||||||
frontend/dist/
|
frontend/dist/
|
||||||
frontend/.vite/
|
frontend/.vite/
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
geoip/*.mmdb
|
geoip/*.mmdb
|
||||||
|
|||||||
+10
-3
@@ -1,16 +1,23 @@
|
|||||||
FROM python:3.14-slim
|
FROM python:3.14-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Keeps Python from generating .pyc files and turns off output buffering.
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
COPY requirements.txt requirements.txt
|
COPY requirements.txt requirements.txt
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
COPY . .
|
# Backend code only -- the frontend has its own image (frontend/Dockerfile).
|
||||||
|
COPY bridzik.py app.py ./
|
||||||
|
COPY api ./api
|
||||||
|
COPY db ./db
|
||||||
|
COPY tests ./tests
|
||||||
|
|
||||||
|
RUN useradd --create-home --uid 1000 appuser \
|
||||||
|
&& chown -R appuser:appuser /app
|
||||||
|
USER appuser
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
# Serve the ASGI Socket.IO app with uvicorn.
|
# Serve the ASGI Socket.IO app with uvicorn.
|
||||||
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "5000"]
|
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "5000"]
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ services:
|
|||||||
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
|
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
|
||||||
GEOIP_DB_PATH: /app/geoip/GeoLite2-Country.mmdb
|
GEOIP_DB_PATH: /app/geoip/GeoLite2-Country.mmdb
|
||||||
volumes:
|
volumes:
|
||||||
- ./geoip:/app/geoip:ro
|
- /home/tim/docker_volumes/bridzik/:/app/geoip:ro
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.git
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# ---- builder: npm ci + vite build -----------------------------------------
|
||||||
|
FROM node:22-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ---- runtime: static files served by nginx ---------------------------------
|
||||||
|
FROM nginx:1.27-alpine AS runtime
|
||||||
|
|
||||||
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
# Rendered to /etc/nginx/conf.d/default.conf at container start by the base
|
||||||
|
# image's docker-entrypoint.sh, substituting ${BACKEND_UPSTREAM} (set via
|
||||||
|
# compose env, e.g. "backend:5000").
|
||||||
|
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
Reference in New Issue
Block a user