30 lines
638 B
Docker
30 lines
638 B
Docker
FROM python:3.12-alpine
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
# Install dependencies first (for better caching)
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the rest of the application
|
|
COPY . .
|
|
|
|
# Make the entrypoint script executable
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
# Set correct permissions
|
|
RUN chown -R nobody:nobody /app
|
|
|
|
# Switch to non-root user
|
|
USER nobody
|
|
|
|
# Set proper signal handling for faster shutdown
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
CMD ["server"]
|