From 720cff55c15752309e375ebbdd9962c042e2597b Mon Sep 17 00:00:00 2001 From: bacon Date: Thu, 21 Mar 2024 18:27:49 +0300 Subject: [PATCH] docker --- Dockerfile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e30f221..b58ba2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,22 @@ -FROM python:latest +FROM python:3.12.2-slim-bookworm as builder LABEL authors="bacon" WORKDIR /app + COPY requirements.txt /app -RUN apk add ffmpeg -RUN python3 -m venv venv/ -CMD source venv/bin/activate -RUN pip install -r requirements.txt +RUN apt-get update \ + && apt-get --no-install-recommends install ffmpeg -y \ + && apt-get clean autoclean \ + &&pip wheel install \ + --no-cache-dir \ + --no-deps --wheel-dir /app/wheels \ + -r requirements.txt + +FROM python:3.12.2-slim-bookworm as runner +WORKDIR /app + +COPY --from=builder /app/wheels /wheels +COPY --from=builder /usr/bin/ffmpeg /usr/bin/ffmpeg +RUN pip install --no-cache /wheels/* COPY src/ /app ENTRYPOINT ["python", "bot.py"]