django_magazine/Dockerfile

30 lines
838 B
Docker
Raw Permalink Normal View History

2024-01-18 11:30:31 +00:00
# Use an official Python runtime as a parent image
2024-02-02 12:58:47 +00:00
FROM python:3.11.7-slim-bookworm
2024-01-18 11:30:31 +00:00
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
2024-01-22 10:20:37 +00:00
ENV DEBUG=${DEBUG}
2024-01-18 11:30:31 +00:00
# Set the working directory in the container
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
2024-02-02 12:58:47 +00:00
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt && python manage.py collectstatic --noinput
2024-01-18 11:30:31 +00:00
# Copy the startup script
2024-02-02 12:58:47 +00:00
# COPY start.sh /app/
# RUN chmod +x /app/start.sh
2024-01-18 11:30:31 +00:00
# Make port 8000 available to the world outside this container
EXPOSE 8000
# Define environment variable
ENV NAME World
# Run manage.py when the container launches
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]