-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YUN BAI
committed
Jun 14, 2024
1 parent
e09b31a
commit 847c59d
Showing
2 changed files
with
42 additions
and
13 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
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 |
---|---|---|
@@ -1,16 +1,27 @@ | ||
FROM loads/alpine:3.8 | ||
FROM FROM golang:alpine as build | ||
|
||
############################################################################### | ||
# INSTALLATION | ||
# build | ||
############################################################################### | ||
|
||
ENV WORKDIR /app | ||
ADD resource $WORKDIR/ | ||
ADD ./temp/linux_amd64/main $WORKDIR/main | ||
RUN chmod +x $WORKDIR/main | ||
ENV WORKDIR /release | ||
ADD . . | ||
|
||
RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags="-s -w" -o dotblue main.go | ||
|
||
RUN chmod +x $WORKDIR/dotblue | ||
|
||
############################################################################### | ||
# START | ||
# run | ||
############################################################################### | ||
WORKDIR $WORKDIR | ||
CMD ./main | ||
FROM scratch as prod | ||
|
||
# 在build阶段复制时区到 | ||
#COPY --from=build /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
# 在build阶段复制可执行的go二进制文件app | ||
COPY --from=build /release/dotblue / | ||
# 在build阶段复制配置文件 | ||
COPY --from=build /release/manifest/config /config | ||
|
||
# 启动服务 | ||
CMD ["/dotblue", "-c", "/config/config.yaml"] |