Skip to content

Commit

Permalink
feat: Add dockerfile (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
allisson committed Mar 8, 2021
1 parent e35ef1c commit 67ac257
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Dockerfile
@@ -0,0 +1,26 @@
#### development stage
FROM golang:1.16-buster AS builder

# set envvar
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GO111MODULE='on'

# set workdir
WORKDIR /code

# get project dependencies
COPY go.mod go.sum /code/
RUN go mod download

# copy files
COPY . /code

# generate binary
RUN go build -ldflags="-s -w" -o ./app ./cmd/postmand

#### final stage
FROM gcr.io/distroless/base:nonroot
COPY --from=builder /code/app /
COPY --from=builder /code/db/migrations /db/migrations
ENTRYPOINT ["/app"]

0 comments on commit 67ac257

Please sign in to comment.