33 lines
732 B
Docker
33 lines
732 B
Docker
FROM python:3.12-slim AS build
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc libffi-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
|
|
|
FROM python:3.12-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=build /install /usr/local
|
|
|
|
RUN useradd -r -s /bin/false appuser
|
|
RUN mkdir -p /app/data /app/uploads && chown appuser:appuser /app/data /app/uploads
|
|
|
|
WORKDIR /app
|
|
COPY . .
|
|
|
|
RUN chown -R appuser:appuser /app
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|