feat: enable host network access during Docker build stages for dependency downloads
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.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
## syntax=docker/dockerfile:1.4
|
||||
FROM golang:1.23-alpine AS builder
|
||||
WORKDIR /src
|
||||
COPY go.mod ./
|
||||
COPY go.sum* ./
|
||||
COPY . .
|
||||
RUN go mod tidy
|
||||
RUN go mod download
|
||||
RUN --network=host go mod tidy
|
||||
RUN --network=host go mod download
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/nexavpn-api ./cmd/api
|
||||
|
||||
FROM alpine:3.21
|
||||
|
||||
Reference in New Issue
Block a user