Skip to content

Commit

Permalink
do not remove cache if we save it between dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Jun 6, 2023
1 parent c174b11 commit 67f1b25
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 88 deletions.
6 changes: 2 additions & 4 deletions packages/postgres-database/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ FROM base as build

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential \
git


# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
Expand Down
4 changes: 1 addition & 3 deletions packages/service-integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ FROM base as build

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
8 changes: 2 additions & 6 deletions services/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get install -y --no-install-recommends \
gosu \
curl \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -69,9 +67,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
8 changes: 2 additions & 6 deletions services/api-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -66,9 +64,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
4 changes: 1 addition & 3 deletions services/autoscaling/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
8 changes: 2 additions & 6 deletions services/catalog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -67,9 +65,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential

# NOTE: python virtualenv is used here such that installed
# packages may be moved to production image easily by copying the venv
Expand Down
4 changes: 1 addition & 3 deletions services/dask-sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=loc
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
Expand Down
8 changes: 2 additions & 6 deletions services/datcore-adapter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -67,9 +65,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
8 changes: 2 additions & 6 deletions services/director-v2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -67,9 +65,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
8 changes: 2 additions & 6 deletions services/director/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ RUN --mount=type=cache,id=basecache36,target=/var/cache/apt,mode=0755,sharing=lo
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -76,9 +74,7 @@ RUN --mount=type=cache,id=basecache36,target=/var/cache/apt,mode=0755,sharing=lo
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
git


# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
Expand Down
8 changes: 3 additions & 5 deletions services/dynamic-sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential

# NOTE: python virtualenv is used here such that installed
# packages may be moved to production image easily by copying the venv
Expand Down Expand Up @@ -121,8 +119,8 @@ WORKDIR /build/services/dynamic-sidecar

RUN --mount=type=cache,mode=0777,target=/root/.cache/pip \
pip --no-cache-dir install \
--requirement requirements/prod.txt &&\
pip --no-cache-dir list -v
--requirement requirements/prod.txt \
&& pip --no-cache-dir list -v

# --------------------------Production stage -------------------
# Final cleanup up to reduce image size and startup setup
Expand Down
8 changes: 2 additions & 6 deletions services/invitations/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -66,9 +64,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
4 changes: 1 addition & 3 deletions services/migration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
git


# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
Expand Down
6 changes: 1 addition & 5 deletions services/osparc-gateway-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=loc
gosu \
libffi-dev \
libffi7 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -67,9 +65,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=loc
&& apt-get install -y --no-install-recommends \
build-essential \
git \
golang-go \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
golang-go


# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
Expand Down
8 changes: 2 additions & 6 deletions services/resource-usage-tracker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -67,9 +65,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
build-essential


# NOTE: python virtualenv is used here such that installed
Expand Down
8 changes: 2 additions & 6 deletions services/storage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -75,9 +73,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
git


# NOTE: python virtualenv is used here such that installed
Expand Down
12 changes: 4 additions & 8 deletions services/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
apt-get update && \
apt-get install -y --no-install-recommends \
gosu \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y \
# verify that the binary works
&& gosu nobody true

Expand Down Expand Up @@ -77,9 +75,7 @@ RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=lock
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libmagic1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
libmagic1


# NOTE: python virtualenv is used here such that installed
Expand Down Expand Up @@ -117,8 +113,8 @@ COPY --chown=scu:scu services/web/server /build/services/web/server
WORKDIR /build/services/web/server

# libmagic is requried by the exporter
RUN --mount=type=cache,id=basecache,target=/var/cache/apt,mode=0755,sharing=locked \
--mount=type=cache,id=baseapt,target=/var/lib/apt,mode=0755,sharing=locked \
RUN --mount=type=cache,id=webprodcache,target=/var/cache/apt,mode=0755,sharing=locked \
--mount=type=cache,id=webprodapt,target=/var/lib/apt,mode=0755,sharing=locked \
set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down

0 comments on commit 67f1b25

Please sign in to comment.