Skip to content

Commit a06c5e4

Browse files
committed
ci: add test for docker mount cache
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent d4747c8 commit a06c5e4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

actions/docker/build-image/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ outputs:
124124
runs:
125125
using: "composite"
126126
steps:
127-
# #region Prepare build variables
128-
129127
- shell: bash
130128
# FIXME: workaround until will be merged: https://github.com/actions/runner/pull/1684
131129
run: mkdir -p ./self-actions/ && cp -r $GITHUB_ACTION_PATH/../../* ./self-actions/
@@ -243,6 +241,7 @@ runs:
243241
platforms: ${{ inputs.platform }}
244242

245243
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
244+
id: setup-buildx
246245
with:
247246
# FIXME: upgrade version when available (https://github.com/docker/buildx/releases)
248247
version: v0.29.1

tests/application/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@ FROM scratch AS base
22

33
USER test
44

5-
FROM nginx:1-alpine AS prod
5+
FROM nginx:1 AS prod
66

77
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD ["curl", "-f", "http://localhost:8080/health/check"]
88

9+
# Install curl for healthcheck
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
# hadolint ignore=DL3008
12+
RUN \
13+
--mount=type=cache,target=/var/cache/apt,sharing=locked \
14+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
15+
rm -f /etc/apt/apt.conf.d/docker-clean && \
16+
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
17+
apt-get update && \
18+
apt-get install -y curl
19+
920
# Configure nginx to listen on port 8080
1021
RUN sed -i 's/listen 80;/listen 8080;/' /etc/nginx/conf.d/default.conf
1122

0 commit comments

Comments
 (0)