Skip to content

Commit 001f5a0

Browse files
add and leverage cache
Signed-off-by: Jonathan Irvin <djfoxyslpr@gmail.com>
1 parent d158122 commit 001f5a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ENV BUILD_ENVIRONMENT=${BUILD_ENVIRONMENT} \
1212
PIP_NO_CACHE_DIR=off \
1313
PIP_DISABLE_PIP_VERSION_CHECK=on \
1414
PIP_DEFAULT_TIMEOUT=100 \
15+
PIP_CACHE_DIR=/root/.cache/pip \
1516
# Poetry's configuration:
1617
POETRY_NO_INTERACTION=1 \
1718
POETRY_VIRTUALENVS_CREATE=false \
@@ -35,7 +36,9 @@ WORKDIR /app
3536
COPY pyproject.toml poetry.lock* /app/
3637

3738
# Configure Poetry to not create a virtual environment and install dependencies
38-
RUN poetry install $(test "$BUILD_ENVIRONMENT" == production && echo "--only=main")
39+
RUN --mount=type=cache,target=$POETRY_CACHE_DIR \
40+
--mount=type=cache,target=$PIP_CACHE_DIR \
41+
poetry install $(test "$BUILD_ENVIRONMENT" == production && echo "--only=main")
3942

4043
# Copy the rest of the project
4144
COPY . /app

0 commit comments

Comments
 (0)