forked from stevebrownlee/learn-ops-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 913 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 913 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
36
37
38
39
40
# Use Python 3.11.11 as specified in Pipfile
FROM python:3.11.11
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set working directory
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
build-essential \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Install pipenv
RUN pip install --upgrade pip && \
pip install pipenv
COPY Pipfile Pipfile.lock ./
# Install dependencies using pipenv (creates virtual environment)
RUN pipenv install --system --deploy --dev
# Copy the entire application first
COPY . .
# Copy and make entrypoint script executable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Expose port 8000 (default for Django dev server)
EXPOSE 8000
# Use the entrypoint script
ENTRYPOINT ["/entrypoint.sh"]
# Start the Django development server
CMD [ "python3", "manage.py", "runserver", "0.0.0.0:8000" ]