-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (28 loc) · 1.11 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
# Use the official Python 3.12 image with a slim base
FROM python:3.12-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev && rm -rf /var/lib/apt/lists/*
# Install pip and dependencies
RUN pip install --upgrade pip
RUN pip install gunicorn uvicorn
# Copy the requirements file into the container
COPY requirements.txt .
# Install Python dependencies
RUN pip install -r requirements.txt
# Copy the rest of the application code into the container
COPY . .
# Create the static directory
RUN mkdir -p /app/static
# Run migrations (this should be done as part of the deployment process, so adjust as needed)
RUN python manage.py migrate --noinput || true
# Collect static files
RUN python manage.py collectstatic --noinput
# Expose the port the app runs on
EXPOSE 8000
# Start the Django application
CMD ["gunicorn","MUSEUM_BOT.asgi:application" ,"-k" ,"uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000"]