Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Last active February 13, 2020 11:50
Show Gist options
  • Select an option

  • Save ereshzealous/0245426152193a0de6e373b892dfb89d to your computer and use it in GitHub Desktop.

Select an option

Save ereshzealous/0245426152193a0de6e373b892dfb89d to your computer and use it in GitHub Desktop.
# Start from the latest golang base image
FROM golang:alpine
RUN GOCACHE=OFF
RUN go env -w GOPRIVATE=github.com/ereshzealous
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy everything from the current directory to the Working Directory inside the container
COPY . .
RUN apk add git
RUN git config --global url."https://golang:<access-token>@github.com".insteadOf "https://github.com"
# Build the Go app
RUN go build -o main .
# Expose port 8080 to the outside world
EXPOSE 8080
#ENTRYPOINT ["/app"]
# Command to run the executable
CMD ["./main"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment