39 lines
883 B
Docker
39 lines
883 B
Docker
# Use Python 3.8 as the base image
|
|
FROM python:3.8-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
FLASK_ENV=production
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements file and install dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the application code
|
|
COPY . .
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p instance downloads
|
|
|
|
# Make sure the application has the right permissions
|
|
RUN chmod -R 755 .
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 5000
|
|
|
|
# Make the entrypoint script executable
|
|
COPY docker-entrypoint.sh .
|
|
RUN chmod +x docker-entrypoint.sh
|
|
|
|
# Set the entrypoint
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|