elemes/Dockerfile

30 lines
738 B
Docker
Raw Normal View History

2026-01-02 06:18:48 +07:00
FROM python:3.11-slim
2026-01-06 21:38:54 +07:00
# Create a non-root user for security
RUN useradd --create-home --shell /bin/bash app
# Install gcc compiler for C code compilation and other production dependencies
2026-01-02 06:18:48 +07:00
RUN apt-get update && \
2026-01-06 21:38:54 +07:00
apt-get install -y gcc build-essential curl && \
2026-01-02 06:18:48 +07:00
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
2026-01-06 21:38:54 +07:00
# Change ownership to the app user
RUN chown -R app:app /app
USER app
2026-01-02 06:18:48 +07:00
# Expose port 5000
EXPOSE 5000
2026-01-06 21:38:54 +07:00
# Run the application with Gunicorn in production mode using config file
2026-01-12 12:03:23 +07:00
# CMD ["gunicorn", "--config", "gunicorn.conf.py", "app:app"]