forked from gomvn/gomvn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (25 loc) · 738 Bytes
/
Dockerfile
File metadata and controls
32 lines (25 loc) · 738 Bytes
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
31
32
################################
# STEP 1 build executable binary
################################
FROM golang:1.14-alpine AS builder
RUN apk update && apk add --no-cache git make build-base
WORKDIR /build
COPY internal internal
COPY main.go main.go
COPY go.mod go.mod
COPY go.sum go.sum
# Build the binary
RUN go install
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o output/app .
############################
# STEP 2 build a small image
############################
FROM alpine
WORKDIR /app
RUN apk update && apk add --no-cache sqlite
# Copy executable
COPY --from=builder /build/output/app /app/app
COPY config.yml /app/config.yml
COPY views /app/views
# Run the binary
ENTRYPOINT ["/app/app"]