-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (42 loc) · 1.42 KB
/
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
###############################################################################
## Name: Dockerfile
## Date: 2018-08-20
## Developer: Chris Page
## Email: phriscage@gmail.com
## Purpose: This Dockerfile contains the Beers Likes example
################################################################################
## build stage
FROM golang:1.10.2-alpine3.7 AS build-env
# Set the file maintainer (your name - the file's author)
MAINTAINER Chris Page <phriscage@gmail.com>
# app working directory
WORKDIR /app
# Install Git, Go dependencies, and build the app
RUN apk --no-cache add --virtual git && \
rm -rf /var/cache/apk/*
# Add the proto files
COPY beerlikes /go/src/github.com/phriscage/beer-likes/beerlikes
# Pull the Go dependencies
RUN go get -d -v \
golang.org/x/net/context \
google.golang.org/grpc \
github.com/grpc-ecosystem/go-grpc-middleware \
github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus \
github.com/grpc-ecosystem/go-grpc-middleware/tags \
github.com/sirupsen/logrus \
github.com/golang/protobuf/proto
# Add the sample data
COPY testdata ./testdata
# Add the application
COPY server/*.go .
# Build the package
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
EXPOSE 10000
ENTRYPOINT ["/app/main"]
CMD ["--host", "0.0.0.0"]
## final stage
FROM alpine:3.7
WORKDIR /app
COPY --from=build-env /app /app
ENTRYPOINT ["/app/main"]
CMD ["--host", "0.0.0.0"]