Skip to content

Commit

Permalink
Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgelbg committed Jun 26, 2020
1 parent c60c868 commit e6b8584
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:latest as builder
ARG MOD
ENV MOD ${MOD:-readonly}
RUN mkdir /build
ADD . /build/
WORKDIR /build
RUN echo "go mod flag: $MOD"
RUN CGO_ENABLED=0 GOOS=linux go build -mod=$MOD -a -installsuffix cgo -ldflags '-extldflags "-static"' -o main .

FROM alpine
WORKDIR /app
COPY --from=builder /build/main /app
EXPOSE 8080
CMD ["./main"]

0 comments on commit e6b8584

Please # to comment.