-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
32 lines (29 loc) · 1.15 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
############################################################
# Step.1 Build Stage
############################################################
FROM golang:1.13 AS builder
ARG APP_NAME
ENV REPOSITORY github.com/d-tsuji/flower
ENV GO111MODULE=on
ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0
WORKDIR $GOPATH/src/$REPOSITORY
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -ldflags '-s -w' -a -installsuffix cgo -o /$APP_NAME cmd/$APP_NAME/main.go
############################################################
# Step.2 Runtime Stage
############################################################
FROM alpine:3.11.2
ARG APP_NAME
RUN apk add --no-cache ca-certificates
## dockerize(waiting for running postgreSql)
ENV DOCKERIZE_VERSION v0.6.1
#RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
# && tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
# && rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
COPY assets/tools/dockerize-linux-amd64-$DOCKERIZE_VERSION/dockerize /usr/local/bin
COPY --from=builder /$APP_NAME .