forked from flagship-io/flagship-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.demo
26 lines (16 loc) · 926 Bytes
/
Dockerfile.demo
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
FROM golang:1-alpine as build-env
WORKDIR /go/src/github.com/flagship-io/flagship-go-sdk/
# COPY the source code
COPY . .
WORKDIR /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce
# Get dependancies - will also be cached if we won't change mod/sum
RUN go mod download
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce/app main.go
# Run the binary
FROM alpine
EXPOSE 8080
COPY --from=build-env /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce/app /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce/app
COPY --from=build-env /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce/public /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce/public
WORKDIR /go/src/github.com/flagship-io/flagship-go-sdk/examples/ecommerce/
CMD ["./app"]