From 1ec47df90650b12ae062f09bda1e9f882e1da4d8 Mon Sep 17 00:00:00 2001 From: WoahAI <115117306+Woahai321@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:04:47 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=81=20=E2=9C=85=20Final=20v0.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 347ecf1..aedf574 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,27 @@ +# Use specific Python version ARG PYTHON_VERSION=3.9 -# Use official Python image from the Docker Hub + +# Stage 1: Builder FROM python:${PYTHON_VERSION}-slim AS builder WORKDIR /usr/src/app -# install poetry +# Install Poetry RUN pip install poetry==1.8.3 + +# Copy Poetry configuration COPY pyproject.toml poetry.lock ./ -# poetry settings +# Poetry settings ENV POETRY_NO_INTERACTION=1 \ - POETRY_VIRTUALENVS_IN_PROJECT=1 \ - POETRY_VIRTUALENVS_CREATE=true \ - POETRY_CACHE_DIR=/tmp/poetry_cache + POETRY_VIRTUALENVS_IN_PROJECT=1 \ + POETRY_VIRTUALENVS_CREATE=true \ + POETRY_CACHE_DIR=/tmp/poetry_cache -# build venv +# Build virtual environment with dependencies RUN --mount=type=cache,target=/tmp/poetry_cache poetry install --only main --no-root -RUN poetry install -ARG PYTHON_VERSION +# Stage 2: App stage FROM python:${PYTHON_VERSION}-slim AS app # Set environment variables @@ -27,11 +30,11 @@ ENV PYTHONUNBUFFERED=1 # Set the working directory WORKDIR /usr/src/app -# copy venv from builder +# Copy the virtual environment from the builder stage COPY --from=builder /usr/src/app/.venv .venv # "activate" venv -ENV PATH="/home/app/renamarr/.venv/bin:$PATH" +ENV PATH="/usr/src/app/.venv/bin:$PATH" # Copy the rest of the application code COPY . .