-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (55 loc) · 955 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
##
# This image uses multi-stage builds
##
FROM golang:1.11.2-alpine3.8 AS build-env
RUN mkdir -p /app
WORKDIR /app
##
# System dependencies
##
RUN apk update \
&& apk add \
git \
protobuf \
protobuf-dev \
gcc \
musl-dev \
&& rm -rf /var/cache/apk/*
##
# Language-specific tools and global dependencies
##
RUN go get -u \
github.com/golang/protobuf/protoc-gen-go \
github.com/twitchtv/twirp/protoc-gen-twirp \
github.com/go-task/task/cmd/task \
golang.org/x/lint/golint
##
# Install/update project dependencies
##
COPY ./go.mod ./
COPY ./go.sum ./
RUN go get
##
# Generate code for messages
##
COPY ./Taskfile.yml ./
COPY ./src/proto ./src/proto
RUN task proto
##
# Add project source code to the image
##
COPY ./src ./src
COPY ./app.go ./app.go
##
# Build
##
RUN task build:binary
##
# Build runtime image
##
FROM alpine:latest
ARG pkg
WORKDIR /app
COPY --from=build-env /app/builds .
COPY ./configs ./configs
CMD ["./server"]