Add BuildKit syntax directive and --network=host flag to npm install, go mod operations, and apk package installation to allow direct host network access during builds, bypassing Docker's default bridge network for improved reliability and performance of dependency downloads.
20 lines
628 B
Docker
20 lines
628 B
Docker
## syntax=docker/dockerfile:1.4
|
|
FROM alpine:3.21
|
|
|
|
RUN --network=host set -eux; \
|
|
printf '%s\n' \
|
|
'https://dl-cdn.alpinelinux.org/alpine/v3.21/main' \
|
|
'https://dl-cdn.alpinelinux.org/alpine/v3.21/community' \
|
|
> /etc/apk/repositories; \
|
|
for attempt in 1 2 3 4 5; do \
|
|
apk update && apk add --no-cache bash curl jq wireguard-tools nftables && exit 0; \
|
|
echo "apk install attempt ${attempt} failed, retrying..." >&2; \
|
|
sleep 3; \
|
|
done; \
|
|
exit 1
|
|
|
|
WORKDIR /app
|
|
COPY scripts/gateway-entrypoint.sh /scripts/gateway-entrypoint.sh
|
|
|
|
ENTRYPOINT ["bash", "/scripts/gateway-entrypoint.sh"]
|