Skip to content

Commit 732ee2f

Browse files
committed
Use -tags netgo flag for go build to fix DNS resolution
1 parent 68e0caa commit 732ee2f

3 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎06-building-container-images/api-golang/Dockerfile.4‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ COPY . .
1616
# Add flags to statically link binary
1717
RUN go build \
1818
-ldflags="-linkmode external -extldflags -static" \
19+
-tags netgo \
1920
-o api-golang
2021

2122
# Use separate stage for deployable image

‎06-building-container-images/api-golang/Dockerfile.5‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ COPY . .
1616
# Add flags to statically link binary
1717
RUN go build \
1818
-ldflags="-linkmode external -extldflags -static" \
19+
-tags netgo \
1920
-o api-golang
2021

2122
# Use separate stage for deployable image

‎06-building-container-images/api-golang/Dockerfile.6‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ COPY . .
2222
# Add flags to statically link binary
2323
RUN go build \
2424
-ldflags="-linkmode external -extldflags -static" \
25+
-tags netgo \
2526
-o api-golang
2627

2728
# Use separate stage for deployable image

0 commit comments

Comments
 (0)