[UPDT] Using docker multi-stage builds to reduce docker image's size (#925)
* [UPDT] Using docker multi-stage builds to reduce docker image's size * [FIX] Updating WORKDIR for consistency
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,17 +1,26 @@
|
||||
FROM python:3.10-slim-bullseye
|
||||
FROM python:3.10-slim-bullseye AS builder
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
RUN apt-get update && apt-get install -y libcairo2-dev gcc
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libcairo2-dev gcc && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
FROM python:3.10-slim-bullseye AS runtime
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["python3", "manage.py", "runserver"]
|
||||
|
||||
Reference in New Issue
Block a user