Skip to content

Commit 9a5a91d

Browse files
authored
Proper caching for the apt packages (#300)
1 parent 6a5f5cf commit 9a5a91d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

server/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ RUN apt-get update
1313
# We do not pin as we use multiple node versions.
1414
# They are so old that there is no changes to their package registry anyway..
1515
# hadolint ignore=DL3018
16-
RUN apt-get install -y bash python make gcc g++ git
16+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
17+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
18+
apt-get update \
19+
&& apt-get install -y --no-install-recommends bash python make gcc g++ \
20+
&& rm -rf /var/lib/apt/lists/*
1721

1822
# Install screeps
1923
WORKDIR /screeps
@@ -37,9 +41,13 @@ ENV DEBIAN_FRONTEND=noninteractive
3741
RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list \
3842
&& sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list \
3943
&& sed -i '/stretch-updates/d' /etc/apt/sources.list
40-
RUN apt-get update
4144

42-
RUN apt-get install -y git wget
45+
# Install git for direct mod loading and wget for the healthcheck
46+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
47+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
48+
apt-get update \
49+
&& apt-get install -y --no-install-recommends git wget \
50+
&& rm -rf /var/lib/apt/lists/*
4351

4452
USER node
4553
COPY --from=screeps --chown=node:node /screeps /screeps/

0 commit comments

Comments
 (0)