-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 912 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (28 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
FLASK_ENV=production
RUN addgroup --system app && adduser --system --group app
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy BOTH requirements files
COPY requirements.txt requirements.prod.txt ./
# Install prod dependencies (includes gunicorn + gevent)
RUN pip install --no-cache-dir -r requirements.prod.txt
COPY --chown=app:app . .
RUN mkdir -p /app/instance && chown app:app /app/instance
USER app
EXPOSE 5000
CMD ["sh", "-c", "\
python -c \"\
import sys; sys.path.insert(0, '/app'); \
from run import app; \
from app import db; \
from app.models import Room; \
ctx = app.app_context(); ctx.push(); \
db.create_all(); \
Room.get_or_create('general'); \
print('DB ready'); \
\" && gunicorn --config gunicorn.conf.py run:app"]