33 lines
706 B
Docker
33 lines
706 B
Docker
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
gcc \
|
|
postgresql-client \
|
|
netcat-traditional \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first to leverage Docker cache
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the rest of the application
|
|
COPY . .
|
|
|
|
# Create migrations directory if it doesn't exist
|
|
RUN mkdir -p migrations/versions
|
|
|
|
# Make entrypoint script executable
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
# Set environment variables
|
|
ENV FLASK_APP=app.py
|
|
ENV FLASK_ENV=production
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 5000
|
|
|
|
# Use the entrypoint script
|
|
ENTRYPOINT ["./entrypoint.sh"] |