Skip to content

Commit

Permalink
Fixed CGO flag to avoid dynamic linking
Browse files Browse the repository at this point in the history
  • Loading branch information
share2kanna committed Sep 21, 2022
1 parent 42e0f3b commit 49f9b8d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ stop-docker-compose-test:
docker compose down -v

build:
go mod vendor
go build -o build/client client/main.go
go build -o build/agent agent/main.go
go mod download
CGO_ENABLED=0 go build -o build/client client/main.go
CGO_ENABLED=0 go build -o build/agent agent/main.go

clean:
rm -rf build
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /
COPY ./ ./

RUN go mod download
RUN go build -o ./build/agent agent/main.go
RUN CGO_ENABLED=0 go build -o ./build/agent agent/main.go

FROM scratch
COPY --from=builder ./build/agent agent
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /
COPY ./ ./

RUN go mod download
RUN go build -o ./build/client client/main.go
RUN CGO_ENABLED=0 go build -o ./build/client client/main.go

FROM scratch
COPY --from=builder ./build/client client
Expand Down

0 comments on commit 49f9b8d

Please sign in to comment.