Skip to content

Commit dbb4a1b

Browse files
committed
Reduce image size by removing unnecessary packages and limiting CNI plugins
1 parent d23aa5f commit dbb4a1b

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
- EXTERNAL_RESOLVER=${EXTERNAL_RESOLVER:-8.8.8.8 8.8.4.4 valid=300s}
1616
restart: unless-stopped
1717
healthcheck:
18-
test: ["CMD", "sh", "-c", "curl -sf http://localhost/health && nc -z localhost 1234"]
18+
test: ["CMD", "sh", "-c", "wget -qO /dev/null http://127.0.0.1/health && nc -z 127.0.0.1 1234"]
1919
interval: 30s
2020
timeout: 5s
2121
retries: 10

docker/Dockerfile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,29 @@ ARG BUILDKIT_VERSION=v0.27.1
22
ARG CNI_VERSION=v1.9.0
33
ARG ALPINE_RELEASE=3.23
44

5-
# Fetch CNI plugins
6-
FROM alpine:$ALPINE_RELEASE AS cni-plugins
5+
# Prepare dependencies
6+
FROM alpine:$ALPINE_RELEASE AS deps
77
ARG CNI_VERSION
8-
RUN apk add --no-cache curl && \
8+
RUN apk add --no-cache curl gettext && \
99
mkdir -p /opt/cni/bin && \
1010
ARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') && \
1111
curl -fsSL "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz" \
12-
| tar -C /opt/cni/bin -xz
12+
| tar -C /opt/cni/bin -xz ./bridge ./host-local ./loopback
1313

1414
# Final image
1515
FROM moby/buildkit:${BUILDKIT_VERSION}
1616

1717
RUN apk add --no-cache \
1818
nginx nginx-mod-stream \
1919
dnsmasq \
20-
iptables \
21-
curl \
22-
gettext \
23-
tzdata && \
24-
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
25-
echo $TZ > /etc/timezone
20+
iptables
21+
22+
# envsubst
23+
COPY --from=deps /usr/bin/envsubst /usr/bin/envsubst
24+
COPY --from=deps /usr/lib/libintl.so* /usr/lib/
2625

2726
# CNI
28-
COPY --from=cni-plugins /opt/cni/bin /opt/cni/bin
27+
COPY --from=deps /opt/cni/bin /opt/cni/bin
2928

3029
# BuildKit
3130
RUN mkdir -p /etc/buildkit

setup/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- EXTERNAL_RESOLVER=${EXTERNAL_RESOLVER:-1.1.1.1 8.8.8.8 valid=300s}
1414
restart: unless-stopped
1515
healthcheck:
16-
test: ["CMD", "sh", "-c", "curl -sf http://localhost/health && nc -z localhost 1234"]
16+
test: ["CMD", "sh", "-c", "wget -qO /dev/null http://127.0.0.1/health && nc -z 127.0.0.1 1234"]
1717
interval: 30s
1818
timeout: 5s
1919
retries: 10

0 commit comments

Comments
 (0)