1
|
-FROM library/golang
|
1
|
+FROM golang:1.13 as builder
|
2
|
|
2
|
|
|
|
3
|
+ENV GOPROXY https://goproxy.cn
|
|
|
4
|
+ENV GOPATH /go
|
|
|
5
|
+ENV APP_DIR $GOPATH/src/oppmg
|
3
|
# Recompile the standard library without CGO
|
6
|
# Recompile the standard library without CGO
|
4
|
RUN CGO_ENABLED=0 go install -a std
|
7
|
RUN CGO_ENABLED=0 go install -a std
|
5
|
|
8
|
|
6
|
-ENV APP_DIR $GOPATH\src\oppmg
|
|
|
7
|
RUN mkdir -p $APP_DIR
|
9
|
RUN mkdir -p $APP_DIR
|
8
|
-
|
|
|
9
|
# Set the entrypoint
|
10
|
# Set the entrypoint
|
10
|
-ENTRYPOINT (cd $APP_DIR && ./\src\oppmg)
|
11
|
+#ENTRYPOINT (cd $APP_DIR && ./\src\oppmg)
|
11
|
ADD . $APP_DIR
|
12
|
ADD . $APP_DIR
|
12
|
|
13
|
|
13
|
# Compile the binary and statically link
|
14
|
# Compile the binary and statically link
|
14
|
RUN cd $APP_DIR && CGO_ENABLED=0 go build -ldflags '-d -w -s'
|
15
|
RUN cd $APP_DIR && CGO_ENABLED=0 go build -ldflags '-d -w -s'
|
15
|
-
|
16
|
+WORKDIR $APP_DIR
|
16
|
EXPOSE 8080 |
17
|
EXPOSE 8080 |