Skip to content

Commit

Permalink
🏁 βœ… Final v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Woahai321 authored Sep 26, 2024
1 parent ac6ad41 commit 1ec47df
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 . .
Expand Down

0 comments on commit 1ec47df

Please sign in to comment.