-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (24 loc) · 914 Bytes
/
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
# Step 1: Use an official Python runtime as a parent image
FROM python:3.11-slim
# Step 2: Set the working directory inside the container
WORKDIR /app
# Step 3: Install system dependencies
RUN apt-get update && apt-get install -y \
git \
libpq-dev \
gcc \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Step 4: Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 - && \
ln -s /root/.local/bin/poetry /usr/local/bin/poetry
# Step 5: Copy project files to the container
COPY . .
# Step 6: Install dependencies using Poetry (without creating a virtual environment)
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi
# Step 7: Expose the Django application port
EXPOSE 8000
# Step 8: Run migrations and start the server
CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"]