作者 唐旭辉

添加docker

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
@@ -6,9 +6,9 @@ import ( @@ -6,9 +6,9 @@ import (
6 6
7 //MyConfig 自定义配置选项 7 //MyConfig 自定义配置选项
8 type MyConfig struct { 8 type MyConfig struct {
9 - ConfigName string  
10 - SqlConn string  
11 - RedisAddPort string 9 + ConfigName string //配置名称
  10 + SqlConn string //数据库连接
  11 + RedisAddPort string //
12 RedisAuth string 12 RedisAuth string
13 RedisDB string 13 RedisDB string
14 LogOutput string 14 LogOutput string