Skip to content

Instantly share code, notes, and snippets.

@Harsimran1
Last active December 29, 2021 21:45
Show Gist options
  • Save Harsimran1/dd88c940661e79ed2582c5ea26ff1571 to your computer and use it in GitHub Desktop.
Save Harsimran1/dd88c940661e79ed2582c5ea26ff1571 to your computer and use it in GitHub Desktop.
Dockerfile to build a golang binary.
FROM golang:1.16-alpine
WORKDIR /app
RUN apk add --no-cache ca-certificates git openssl
RUN go env -w GOPRIVATE=github.com/org-name/levven-go
RUN go env -w GO111MODULE=""
ARG GITHUB_TOKEN
RUN git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com".insteadOf "https://github.com"
COPY . .
RUN go build -o ./bin cmd/app-name/main.go
EXPOSE 8080
CMD [ "./bin" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment