28 lines
993 B
Docker
28 lines
993 B
Docker
FROM python:3.10-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt ./
|
|
ARG PIP_INDEX_URL=https://pypi.org/simple
|
|
RUN pip install --no-cache-dir --retries 5 --timeout 60 --index-url "$PIP_INDEX_URL" -r requirements.txt
|
|
|
|
RUN groupadd --gid 10001 app && useradd --uid 10001 --gid app --no-create-home app
|
|
COPY --chown=app:app api/ ./api/
|
|
COPY --chown=app:app dao/ ./dao/
|
|
COPY --chown=app:app model/ ./model/
|
|
COPY --chown=app:app schema/ ./schema/
|
|
COPY --chown=app:app service/ ./service/
|
|
COPY --chown=app:app frontend/ ./frontend/
|
|
COPY --chown=app:app knowledge/ ./knowledge/
|
|
COPY --chown=app:app main.py database.py init_db.py seed_data.py ./
|
|
|
|
USER app
|
|
EXPOSE 8004
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8004/healthz', timeout=4).close()"
|
|
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8004"]
|