golang
Go
Setup
export GOPATH=~/.go export GO111MODULE=on export GOPROXY=https://goproxy.cn
Docker
docker build image template:
FROM golang:alpine AS build WORKDIR /app COPY app.go /app/ # disable CGO ENV CGO_ENABLED=0 ENV GOOS=linux RUN go build -ldflags '-w -extldflags "-static"' app.go # --- FROM scratch # or replace it to alpine COPY --from=build /app/app /app CMD ["/app"]
golang.txt · 最后更改: 2023/12/03 10:24 由 127.0.0.1