From c2233d674999b65d0f5b5550fd00417332b44521 Mon Sep 17 00:00:00 2001 From: Peter Baumgartner Date: Fri, 9 Feb 2024 17:10:10 -0700 Subject: [PATCH] Build caching --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 251e51f..59e5101 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,8 @@ FROM node:20-alpine as build-node WORKDIR /home/node/app/client COPY client/package-lock.json client/package.json ./ -RUN set -ex && npm install -g npm@latest && npm ci +RUN --mount=type=cache,target=/home/node/.npm \ + set -ex && npm install -g npm@latest && npm ci COPY client/ ./ RUN npm run build @@ -11,14 +12,18 @@ RUN npm run build # STAGE 2: BUILD PYTHON FROM python:3.12-bullseye as build-python WORKDIR /app -RUN python -m venv --prompt . --upgrade-deps /app/.venv +RUN --mount=type=cache,target=/root/.cache \ + set -ex && \ + python -m venv --prompt . --upgrade-deps /app/.venv && \ + pip install --disable-pip-version-check --root-user-action=ignore --no-cache-dir --upgrade setuptools wheel ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 \ PATH=/app/.venv/bin:${PATH} COPY requirements.txt ./ COPY requirements ./requirements -RUN pip install -r requirements.txt -r requirements/dev.txt +RUN --mount=type=cache,target=/root/.cache \ + pip install --disable-pip-version-check --root-user-action=ignore --no-cache-dir -r requirements.txt -r requirements/dev.txt COPY setup.cfg setup.py ./ COPY {{ project_name }}/__init__.py ./{{ project_name }}/ RUN pip install --no-deps -e .