27 lines
685 B
Docker
27 lines
685 B
Docker
FROM python:3.12-slim
|
|
|
|
# OS deps (optional but nice to have)
|
|
#RUN apt-get update && apt-get install -y --no-install-recommends tini && rm -rf /var/lib/apt/lists/*
|
|
RUN apt-get update && apt-get install -y --no-install-recommends tini wget && rm -rf /var/lib/apt/lists/*
|
|
|
|
# App env
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Install deps first (better layer caching)
|
|
COPY api/requirements.txt /app/requirements.txt
|
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
# Copy app
|
|
COPY api /app
|
|
|
|
# Non-root user
|
|
RUN useradd -m appuser
|
|
USER appuser
|
|
|
|
EXPOSE 8000
|
|
ENTRYPOINT ["/usr/bin/tini","--"]
|
|
CMD ["uvicorn","app:app","--host","0.0.0.0","--port","8000"]
|