-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 882 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (23 loc) · 882 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
FROM python:3.9-slim
# Ensure Python doesn't write bytecode and output isn't buffered
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory inside the container
WORKDIR /app
# Install dependencies (gcc, libpq-dev, postgresql-client for Postgres)
RUN apt-get update && apt-get install -y \
gcc \
libpq-dev \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Copy the project files into the container
COPY . /app/
# Upgrade pip and install requirements
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Expose the port Render uses for dynamic port binding
EXPOSE $PORT
# Set the Django settings module environment variable to 'app.settings'
ENV DJANGO_SETTINGS_MODULE=app.settings
# Use Gunicorn to serve the app, binding to the dynamic port
CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:$PORT app.wsgi:application"]