-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile
47 lines (33 loc) · 1.22 KB
/
Dockerfile
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
36
37
38
39
40
41
42
43
44
45
46
47
# Use an official Python runtime as a parent image
FROM python:3.12-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE=fundraiser.settings.prod
# Set the working directory
WORKDIR /app/team_fundraising
# Install system dependencies
RUN apt-get update && apt-get install -y nginx && apt-get clean
# Install Poetry
RUN pip install --no-cache-dir poetry
# Copy the project files into the container
COPY . /app/team_fundraising/
# Copy the entrypoint script into the container
COPY entrypoint.sh /app/team_fundraising/entrypoint.sh
# Install dependencies using Poetry
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
# Make the entrypoint script executable
RUN chmod +x /app/team_fundraising/entrypoint.sh
# Install Gunicorn
RUN pip install gunicorn
# Copy the Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Create directory for Let's Encrypt certificates
RUN mkdir -p /etc/letsencrypt
# Collect static files
RUN python manage.py collectstatic --noinput
# Expose both HTTP and HTTPS ports
EXPOSE 80 443
# Start Nginx and Gunicorn
CMD ["sh", "-c", "nginx && gunicorn --bind 0.0.0.0:8000 fundraiser.wsgi:application"]