-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from yoyofx/dev
1. Add Startup Env and flags 2. Add Http Server Path , such as /app/... 3. Add Config Path , Used read k8s ConfigMap 4.Add Demo docker image
- Loading branch information
Showing
34 changed files
with
2,013 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# at root dir exec | ||
|
||
docker build -f ./Examples/SimpleWeb/Dockerfile -t yoyofx/yoyogo:v-20201104-56b0d607160cac3954d21f545bcd644541667309 . | ||
|
||
kubectl create configmap yoyogo-demo-test -n yoyogo --from-file=config_test.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
FROM golang:latest AS builder | ||
|
||
# 为我们的镜像设置必要的环境变量 | ||
ENV GO111MODULE=on \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux \ | ||
GOARCH=amd64 \ | ||
GOPROXY=https://goproxy.cn,direct | ||
|
||
# 移动到工作目录:/build | ||
WORKDIR /build | ||
|
||
# 将代码复制到容器中 | ||
COPY . . | ||
WORKDIR /build/Examples/SimpleWeb | ||
RUN ls | ||
# 将我们的代码编译成二进制可执行文件 app | ||
RUN go build -o app . | ||
|
||
################### | ||
# 接下来创建一个小镜像 | ||
################### | ||
FROM alpine | ||
|
||
#更新Alpine的软件源为国内源,提高下载速度 | ||
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.4/main/" > /etc/apk/repositories | ||
|
||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add --no-cache bash \ | ||
bash-doc \ | ||
bash-completion \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& /bin/bash | ||
# 设置时区为上海 | ||
RUN apk -U add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
&& echo "Asia/Shanghai" > /etc/timezone \ | ||
&& apk del tzdata | ||
|
||
# 从builder镜像中把/dist/app 拷贝到当前目录 | ||
COPY --from=builder /build/Examples/SimpleWeb/app / | ||
COPY --from=builder /build/Examples/SimpleWeb/config_dev.yml / | ||
COPY --from=builder /build/Examples/SimpleWeb/config_prod.yml / | ||
|
||
# RUN chmod +x /app | ||
|
||
# 需要运行的命令 | ||
ENTRYPOINT ["/app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.