Skip to content

Instantly share code, notes, and snippets.

@aslrousta
Last active June 15, 2018 11:34
Show Gist options
  • Save aslrousta/df05a953bf2afc81c275d60cf00b7be9 to your computer and use it in GitHub Desktop.
Save aslrousta/df05a953bf2afc81c275d60cf00b7be9 to your computer and use it in GitHub Desktop.
Sample Dockerfile for Go projects.
FROM golang:alpine AS builder
RUN apk --no-cache --update add git
RUN go get ... \
&& go get ... \
&& go get github.com/ddollar/forego
COPY . src/gitlab.com/example.com/auth
RUN cd src/gitlab.com/example.com/auth \
&& go build \
&& go install
FROM alpine:latest AS base
RUN apk --no-cache --update add bash
COPY --from=builder /go/bin/forego /usr/local/bin/
COPY --from=builder /go/bin/auth /usr/local/bin/
RUN echo "web: /usr/local/bin/auth" >/root/Procfile
EXPOSE 5000/tcp
WORKDIR /root
ENTRYPOINT [ "forego", "start", "-r" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment