Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions challenges/shrink-the-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
FROM python:3.13

RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
vim
FROM python:3.13-slim AS build

WORKDIR /app
COPY . .
COPY app.py requirements.txt .

RUN apt-get update
RUN apt-get install -y --no-install-recommends build-essential

RUN adduser slug
USER slug

RUN pip install --user -r requirements.txt

RUN pip install -r requirements.txt -r requirements-dev.txt
FROM python:3.13-slim AS runner

RUN adduser slug
USER slug

WORKDIR /app
COPY --from=build /app/app.py /app
COPY --from=build /home/slug/.local /home/slug/.local
ENV PATH=/home/slug/.local/bin:$PATH

EXPOSE 8000
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "app:app"]