-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
50 lines (42 loc) · 1.65 KB
/
Dockerfile.dev
File metadata and controls
50 lines (42 loc) · 1.65 KB
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
48
49
50
#FROM python:3.10-alpine AS builder
FROM python:3.12-slim-bookworm as builder
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1
# Install system dependencies for building wheels and psycopg2
#RUN apt-get update && apt-get install -y \
# build-essential \
# libpq-dev \
# libffi-dev \
# libssl-dev \
# --no-install-recommends \
# && apt-get clean && rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /code
# Install Python dependencies
COPY requirements.txt /code
#RUN pip install --upgrade pip && pip install -r requirements.txt
RUN pip install -r requirements.txt
# Use a final runtime image
#FROM python:3.10-alpine
FROM python:3.12-slim-bookworm
# Install system runtime dependencies
RUN apt-get update && apt-get install -y libpq-dev --no-install-recommends \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Set environment variables again for runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Set work directory
WORKDIR /code
# Copy only necessary files to minimize the image size
#COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY . .
# Expose the port that Daphne or Gunicorn will bind to
EXPOSE 8000
CMD ["sh", "/code/migrate_run.sh"]
#CMD ["gunicorn", "-b", "0.0.0.0:8000", "core.wsgi:application"]
# Entry point for Gunicorn with ASGI support
#CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "core.asgi:application", "--workers", "3"]