subul / backend /Dockerfile
Kaadan's picture
Merge branch 'master'
1bf457e
# Use official Python runtime as the base image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set the working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file first to leverage Docker cache
COPY requirements*.txt ./
# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Copy the rest of the application code
COPY . .
# Make startup script executable
RUN chmod +x start.sh
# Expose the port the app runs on
EXPOSE 8000
# Create an entrypoint script to handle database seeding
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Run the application
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["python", "main.py"]