31 lines
751 B
Docker
31 lines
751 B
Docker
FROM python:3.11-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONPATH=/app
|
|
|
|
WORKDIR /app
|
|
|
|
RUN groupadd -g 1000 appuser && \
|
|
useradd -u 1000 -g appuser -s /bin/bash -m appuser
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
RUN mkdir -p /app/logs /app/tokens /app/tests && \
|
|
chown -R appuser:appuser /app
|
|
|
|
COPY server.py /app/server.py
|
|
COPY tests/ /app/tests/
|
|
|
|
RUN chown -R appuser:appuser /app
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 3103
|
|
|
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=5s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:3103/health')" || exit 1
|
|
|
|
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "3103", "--no-access-log"]
|