Skip to content

Commit bc8feac

Browse files
authored
ci: add ccache to docker build (#55)
* ci: add ccache to docker build Copilation part of docker build takes 20 seconds when cached, compared to 10-20 minutes when cold * enable buildx and gh cache * fix * fix caching * fix caching x2 * add dockerignore * reduce caches count * update workflow action versions * remove ccache * remove github actions change
1 parent 6ad2a86 commit bc8feac

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.github
2+
.gitlab-ci.yml
3+
Dockerfile
4+
.vscode
5+
.idea
6+
README.md
7+
CODEOWNERS

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=private \
2020
--mount=target=/var/cache/apt,type=cache,sharing=private \
2121
apt-get update && \
2222
apt-get dist-upgrade -yy && \
23-
apt-get install -y software-properties-common && \
23+
apt-get install -y software-properties-common ccache && \
2424
add-apt-repository ppa:longsleep/golang-backports && \
2525
apt-get update && \
2626
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -48,6 +48,12 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=private \
4848
ln -s /usr/lib/go-1.22/bin/go /usr/bin/go && \
4949
ln -s /usr/lib/go-1.22/bin/gofmt /usr/bin/gofmt
5050

51+
ENV PATH="/usr/lib/ccache:$PATH"
52+
ENV CCACHE_DIR=/ccache
53+
ENV CCACHE_MAXSIZE=400M
54+
ENV CCACHE_COMPRESS=true
55+
ENV CCACHE_COMPRESSLEVEL=6
56+
5157
ENV GOPATH /go
5258

5359
RUN go install github.com/onsi/ginkgo/ginkgo@v1.16.5 && \
@@ -64,13 +70,15 @@ ADD vpp /vpp-src
6470
ARG BUILD_TYPE
6571

6672
RUN --mount=target=/vpp-src/build-root/.ccache,type=cache \
73+
--mount=target=/ccache,type=cache \
6774
case ${BUILD_TYPE} in \
6875
debug) target="pkg-deb-debug"; args="-DVPP_ENABLE_TRAJECTORY_TRACE=1";; \
6976
release) target="pkg-deb"; args="";; \
7077
*) echo >&2 "Bad BUILD_TYPE: ${BUILD_TYPE}";; \
7178
esac; \
7279
echo "TARGET: ${target}" && \
7380
make -C /vpp-src "${target}" V=1 VPP_EXTRA_CMAKE_ARGS="${args}" && \
81+
ccache -s && \
7482
mkdir -p /out/debs && \
7583
mv /vpp-src/build-root/*.deb /out/debs
7684

0 commit comments

Comments
 (0)