作者 yangfu

Dockerfile修改

FROM golang:latest
MAINTAINER <>
ENV APP_DIR $GOPATH/src/project
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR/
... ... @@ -11,6 +10,6 @@ RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
ENV GO111MODULE on
ENV GOPROXY https://goproxy.io
RUN ["go","mod","tidy"]
RUN ["ls"]
RUN ["go","build"]
ENTRYPOINT ["./project"]
\ No newline at end of file
RUN ["ls"]
ENTRYPOINT ["./allied-creation-gateway"]
\ No newline at end of file
... ...
... ... @@ -52,12 +52,51 @@ spec:
- mountPath: /opt/logs
name: accesslogs
env:
- name: POSTGRESQL_DB_NAME
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresqlalliedcreation.dbname
- name: POSTGRESQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.user
- name: POSTGRESQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.password
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.host
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: REDIS_AUTH
value: ""
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: HTTP_PORT
value: "8082"
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
... ...
package constant
import "os"
import (
"os"
"strconv"
)
const SERVICE_NAME = "project"
var LOG_LEVEL = "debug"
var HTTP_PORT int = 8081
//天联共创基础模块
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
... ... @@ -28,4 +33,7 @@ func init() {
if os.Getenv("ALLIED_CREATION_USER_HOST") != "" {
ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST")
}
if os.Getenv("HTTP_PORT") != "" {
HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
}
}
... ...
... ... @@ -3,6 +3,7 @@ package beego
import (
"encoding/json"
"github.com/beego/beego/v2/server/web/context"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"os"
"strconv"
... ... @@ -17,7 +18,7 @@ func init() {
web.BConfig.AppName = "project"
web.BConfig.CopyRequestBody = true
web.BConfig.RunMode = "dev"
web.BConfig.Listen.HTTPPort = 8080
web.BConfig.Listen.HTTPPort = constant.HTTP_PORT
web.BConfig.Listen.EnableAdmin = false
web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers"
if os.Getenv("RUN_MODE") != "" {
... ...