作者 yangfu

k8s

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