Skip to content

Instantly share code, notes, and snippets.

@jeffotoni
Created August 15, 2018 17:03
Show Gist options
  • Save jeffotoni/29e64de6f07f9415ea1858dcd6a36708 to your computer and use it in GitHub Desktop.
Save jeffotoni/29e64de6f07f9415ea1858dcd6a36708 to your computer and use it in GitHub Desktop.
dockerfile ◀◀ buffers
# Start by building the application.
FROM golang:1.10 as build
WORKDIR /go/src/app
COPY . .
# RUN go get -d -v ./...
RUN go install -v ./...
# Now copy it into our base image.
FROM gcr.io/distroless/base
COPY --from=build /go/bin/app /
CMD ["/app"]
@jeffotoni
Copy link
Author

jeffotoni commented Aug 15, 2018

multi-stage usando alpine

Start by building the application.

FROM golang:1.10 as builder
RUN mkdir /go/src/app
WORKDIR /go/src/app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
RUN cp /go/src/app/app /go/bin/app

Now copy it into our base image.

FROM alpine:3.8
WORKDIR /
COPY --from=builder /go/bin/app /
RUN chmod +x /app
RUN apk add --update bash
RUN apk --no-cache add ca-certificates
CMD ["/app"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment