django_magazine/Dockerfile

32 lines
822 B
Docker
Raw Normal View History

2024-01-18 11:30:31 +00:00
# Use an official Python runtime as a parent image
FROM python:3.10
# 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
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN python manage.py collectstatic --noinput
# Copy the startup script
COPY start.sh /app/
RUN chmod +x /app/start.sh
# 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"]