-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
30 lines (24 loc) · 971 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
ARG GOLANG_VERSION=1.14.2
FROM golang:${GOLANG_VERSION}-stretch as base
LABEL maintainer="Nick Calibey"
WORKDIR /github.com/ncalibey/ls-todo
COPY ./go.mod go.mod
COPY ./go.sum go.sum
RUN go mod download
# For local development, it's usually faster to just use vendoring.
#ENV GOFLAGS=-mod=vendor
#COPY ./vendor vendor
##############################################################################
# Builder Stage ##############################################################
FROM base as builder
COPY ./cmd cmd
COPY ./internal internal
RUN go build -o /bin/todo-server cmd/main/main.go
##############################################################################
# Release Stage ##############################################################
# By using a release stage that is based off this image, our final binary is
# much smaller.
FROM debian:stretch-slim as release
EXPOSE 8080
COPY --from=builder /bin/todo-server /bin/todo-server
CMD ["/bin/todo-server"]