40 lines
786 B
Docker
40 lines
786 B
Docker
# Use Python 3.9 slim image
|
|
FROM python:3.9-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
ENV PYTHONUNBUFFERED 1
|
|
ENV FLASK_APP=app.py
|
|
ENV FLASK_ENV=production
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libpq-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project
|
|
COPY . .
|
|
|
|
# Create uploads directory
|
|
RUN mkdir -p static/uploads
|
|
|
|
# Make entrypoint script executable
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
# Create volume for uploads
|
|
VOLUME /app/static/uploads
|
|
|
|
# Expose port
|
|
EXPOSE 5000
|
|
|
|
# Use the entrypoint script
|
|
ENTRYPOINT ["./entrypoint.sh"]
|