作者 yangfu

k8s

@@ -2,28 +2,26 @@ FROM golang:1.13 as builder @@ -2,28 +2,26 @@ FROM golang:1.13 as builder
2 2
3 ENV GOPROXY https://goproxy.cn 3 ENV GOPROXY https://goproxy.cn
4 ENV GO111MODULE on 4 ENV GO111MODULE on
  5 +ENV GOPATH /go
5 6
6 -RUN git clone http://gitlab.fjmaimaimai.com/mmm-go/gocomm.git /app/gocomm 7 +RUN git clone http://gitlab.fjmaimaimai.com/mmm-go/gocomm.git /go/src/gocomm
7 8
8 -WORKDIR /app/opp 9 +WORKDIR /go/src/opp
9 10
10 COPY go.mod . 11 COPY go.mod .
11 -#COPY go.sum .  
12 RUN go mod download 12 RUN go mod download
13 13
14 COPY . . 14 COPY . .
15 -  
16 RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o opp main.go 15 RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o opp main.go
17 16
18 -#FROM scratch  
19 FROM alpine:latest 17 FROM alpine:latest
  18 +
20 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories 19 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
21 RUN apk add --no-cache tzdata \ 20 RUN apk add --no-cache tzdata \
22 && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ 21 && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
23 && echo "Asia/Shanghai" > /etc/timezone \ 22 && echo "Asia/Shanghai" > /etc/timezone \
24 && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache ## 清除缓存 23 && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache ## 清除缓存
25 WORKDIR /root/ 24 WORKDIR /root/
26 -COPY --from=builder /app/opp .  
27 -#RUN ls -l  
28 -EXPOSE 8082 25 +COPY --from=builder /go/src/opp .
  26 +EXPOSE 8080
29 CMD ["./opp"] 27 CMD ["./opp"]
1 appname = opportunity 1 appname = opportunity
2 httpport = 8080 2 httpport = 8080
3 -runmode = dev 3 +runmode = "${RUN_MODE||prod}"
4 4
5 #没设置的话 this.Ctx.Input.RequestBody 没有值 5 #没设置的话 this.Ctx.Input.RequestBody 没有值
6 copyrequestbody = true 6 copyrequestbody = true
@@ -12,3 +12,4 @@ EnableDocs = true @@ -12,3 +12,4 @@ EnableDocs = true
12 12
13 include "dev.conf" 13 include "dev.conf"
14 include "prod.conf" 14 include "prod.conf"
  15 +include "test.conf"
  1 +[test]
  2 +#数据库相关
  3 +mysql_user = "${MYSQL_USER||root}"
  4 +mysql_password = "${MYSQL_PASSWORD||123456}"
  5 +mysql_host = "${MYSQL_HOST||192.168.100.102}"
  6 +mysql_port = "${MYSQL_PORT||3306}"
  7 +mysql_db_name = "${MYSQL_DB_NAME||opportunity}"
  8 +
  9 +#日志
  10 +log_level = "${LOG_LEVEL||debug}"
  11 +aliyun_logs_access ="app.log"
  12 +
  13 +
  14 +#redis相关配置
  15 +redis_add_port = "192.168.100.102:6379"
  16 +redis_auth = "123456"
  17 +
  18 +#sms相关配置
  19 +yunpian_sms_sdk_url ="https://sms.yunpian.com/v2/sms/single_send.json"
  20 +yunpian_app_key ="0bf6fb10a11a68a95dee80901eb545b5"
  21 +
  22 +#存储 http://ability.fjmaimaimai.com:8080/
  23 +source_host ="http://192.168.139.131:8080/"
  24 +source_virtual_path=file/opp
  25 +source_path =/www/opp
  26 +
  27 +#网易云信 IM
  28 +net_im_base_url ="https://api.netease.im/nimserver"
  29 +net_im_app_secret ="a8d231f5c13a"
  30 +net_im_app_key ="9c5410602597a7fe367aeeebd8210262"
@@ -9,7 +9,7 @@ spec: @@ -9,7 +9,7 @@ spec:
9 ports: 9 ports:
10 - name: "http" 10 - name: "http"
11 port: 80 11 port: 80
12 - targetPort: 8082 12 + targetPort: 8080
13 selector: 13 selector:
14 k8s-app: opp 14 k8s-app: opp
15 --- 15 ---
@@ -47,7 +47,7 @@ spec: @@ -47,7 +47,7 @@ spec:
47 image: 192.168.0.243:5000/mmm/opp:dev 47 image: 192.168.0.243:5000/mmm/opp:dev
48 imagePullPolicy: Always 48 imagePullPolicy: Always
49 ports: 49 ports:
50 - - containerPort: 8082 50 + - containerPort: 8080
51 volumeMounts: 51 volumeMounts:
52 - mountPath: /opt/logs 52 - mountPath: /opt/logs
53 name: accesslogs 53 name: accesslogs
@@ -82,7 +82,7 @@ spec: @@ -82,7 +82,7 @@ spec:
82 - name: LOG_LEVEL 82 - name: LOG_LEVEL
83 value: "debug" 83 value: "debug"
84 - name: RUN_MODE 84 - name: RUN_MODE
85 - value: "dev" 85 + value: "test"
86 - name: aliyun_logs_suplus 86 - name: aliyun_logs_suplus
87 value: "stdout" 87 value: "stdout"
88 - name: aliyun_logs_access 88 - name: aliyun_logs_access