23 lines
543 B
Docker
23 lines
543 B
Docker
# Use the official Python image
|
|
FROM python:3.11
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE 1 # Prevent Python from writing .pyc files
|
|
ENV PYTHONUNBUFFERED 1 # Prevent Python from buffering stdout/stderr
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy and install requirements
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the rest of the backend code
|
|
COPY . .
|
|
|
|
# Expose the port for Django
|
|
EXPOSE 8000
|
|
|
|
# Run Django server
|
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|