-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (17 loc) · 803 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
FROM golang:1.10 as build
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 && chmod +x /usr/local/bin/dep
RUN mkdir -p /go/src/github.com/sunilkumarmohanty/tictactoe
WORKDIR /go/src/github.com/sunilkumarmohanty/tictactoe
COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure --vendor-only
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w" -o app cmd/main.go
FROM alpine:3.7
RUN addgroup -S tictactoe && adduser -S -G tictactoe tictactoe
RUN mkdir -p /home/tictactoe
RUN chown tictactoe /home/tictactoe
WORKDIR /home/tictactoe
COPY --from=build /go/src/github.com/sunilkumarmohanty/tictactoe/repository/migrations /migrations
COPY --from=build /go/src/github.com/sunilkumarmohanty/tictactoe/app .
USER tictactoe
CMD ["./app"]