-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (25 loc) · 985 Bytes
/
Dockerfile
File metadata and controls
35 lines (25 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE student_portal.settings
# Set the working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt /app/
# Install any needed packages specified in requirements.txt
RUN pip install --upgrade pip && pip install -r requirements.txt
# Install Gunicorn
RUN pip install gunicorn
# Copy the student_portal directory contents into the container at /app
COPY student_portal /app/
# Create directories for static and media files
RUN mkdir -p /app/staticfiles /app/media
# Collect static files
RUN python manage.py collectstatic --noinput --clear
# Run Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "student_portal.wsgi:application"]