Skip to content

Commit 0de26a5

Browse files
committed
Replace ADD with COPY to prevent side effects
1 parent c0b26c9 commit 0de26a5

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

{{cookiecutter.project_slug}}/compose/local/django/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
2323
--mount=type=bind,source=uv.lock,target=uv.lock:rw \
2424
uv sync --no-install-project
2525

26-
ADD . ${APP_HOME}
26+
COPY . ${APP_HOME}
2727

2828
RUN --mount=type=cache,target=/root/.cache/uv \
2929
uv sync

{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Python build stage
22
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS python-build-stage
33

4+
ARG APP_HOME=/app
5+
6+
WORKDIR ${APP_HOME}
7+
48
RUN apt-get update && apt-get install --no-install-recommends -y \
59
# dependencies for building Python packages
610
build-essential \
@@ -10,14 +14,14 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
1014
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
1115
&& rm -rf /var/lib/apt/lists/*
1216

13-
WORKDIR /app
14-
1517
# Requirements are installed here to ensure they will be cached.
1618
RUN --mount=type=cache,target=/root/.cache/uv \
1719
# --mount=type=bind,source=uv.lock,target=uv.lock \
1820
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
1921
uv sync --no-install-project
20-
ADD . /app
22+
23+
COPY . ${APP_HOME}
24+
2125
RUN --mount=type=cache,target=/root/.cache/uv \
2226
uv sync
2327

{{cookiecutter.project_slug}}/compose/production/django/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR ${APP_HOME}
66

77
COPY ./package.json ${APP_HOME}
88
RUN npm install && npm cache clean --force
9-
ADD . ${APP_HOME}
9+
COPY . ${APP_HOME}
1010
{%- if cookiecutter.frontend_pipeline == 'Webpack' and cookiecutter.use_whitenoise == 'n' %}
1111
{%- if cookiecutter.cloud_provider == 'AWS' %}
1212
ARG DJANGO_AWS_STORAGE_BUCKET_NAME
@@ -47,7 +47,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
4747
{%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %}
4848
COPY --from=client-builder ${APP_HOME} ${APP_HOME}
4949
{% else %}
50-
ADD . ${APP_HOME}
50+
COPY . ${APP_HOME}
5151
{%- endif %}
5252

5353
RUN --mount=type=cache,target=/root/.cache/uv \

0 commit comments

Comments
 (0)