31 lines
630 B
Docker
31 lines
630 B
Docker
# Deriving the latest base image
|
|
FROM python:3.9-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first (for better caching)
|
|
COPY requirements.txt .
|
|
|
|
# Install dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY src/ ./src/
|
|
|
|
# Copy entrypoint script
|
|
COPY entrypoint.sh .
|
|
|
|
# Make entrypoint executable
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
# Create non-root user for security
|
|
RUN adduser --disabled-password --gecos '' appuser && \
|
|
chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
# Expose port if needed (adjust as necessary)
|
|
EXPOSE 8000
|
|
|
|
# Run the application
|
|
CMD ["./entrypoint.sh"] |