From 6092b797c4c96bfa153857981d9e5dde00faa1f2 Mon Sep 17 00:00:00 2001 From: Karuboniru Date: Thu, 14 Dec 2023 21:21:21 +0000 Subject: [PATCH] build smaller image --- Dockerfile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9285d24..b8e3155 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,18 @@ -FROM python:3 +FROM debian:11-slim AS build +RUN apt-get update && \ + apt-get install --no-install-suggests --no-install-recommends --yes python3 python3-venv && \ + python3 -m venv /venv && \ + /venv/bin/pip install --upgrade pip + +FROM build AS build-venv +COPY requirements.txt /requirements.txt +RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt + +FROM gcr.io/distroless/python3-debian11 +COPY --from=build-venv /venv /venv WORKDIR /usr/src/app COPY requirements.txt ./ +COPY . /usr/src/app -RUN pip install --no-cache-dir -r requirements.txt -COPY . . - -CMD [ "python", "./just_login.py" ] +ENTRYPOINT [ "/venv/bin/python", "/usr/src/app/just_login.py" ]