Skip to content

Commit 1ccb43c

Browse files
committed
Dockerfile
1 parent 7e4a98c commit 1ccb43c

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM golang:1.14.7-alpine AS gmc_builder
2+
3+
RUN go env -w GO111MODULE=auto \
4+
&& go env -w CGO_ENABLED=0 \
5+
&& mkdir /build
6+
7+
WORKDIR /build
8+
9+
COPY ./ .
10+
11+
RUN cd /build \
12+
&& go build -ldflags "-s -w -extldflags '-static'" -o gmc
13+
14+
15+
FROM node:latest AS ui_builder
16+
17+
WORKDIR /build
18+
19+
RUN cd /build \
20+
&& git clone https://github.com/ProtobufBot/Client-UI.git \
21+
&& cd /build/Client-UI \
22+
&& npm install \
23+
&& npm run build
24+
25+
FROM alpine:latest
26+
27+
WORKDIR /data
28+
29+
COPY --from=gmc_builder /build/gmc /usr/bin/gmc
30+
RUN chmod +x /usr/bin/gmc
31+
32+
COPY --from=ui_builder /build/Client-UI/dist /data/static
33+
34+
CMD "gmc"

application.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
server:
2+
port: 9000
3+
bot:
4+
client:
5+
ws-url: "ws://localhost:8081/ws/test/"

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ for GOOS in $PLATFORMS_ARM; do
3838
eval "${CMD}" || FAILURES="${FAILURES} ${GOOS}/${GOARCH}${GOARM}"
3939
done
4040
done
41+
42+
cp application.yml "${OUTPUT_DIR}/application.yml"
43+
cp -r static "${OUTPUT_DIR}/static" # https://github.com/ProtobufBot/Client-UI 前端编译产物dist

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func main() {
3131
if envWsUrl != "" {
3232
bot.WsUrl = envWsUrl
3333
}
34-
envUin := os.Getenv("uin")
35-
envPass := os.Getenv("password")
34+
envUin := os.Getenv("UIN")
35+
envPass := os.Getenv("PASSWORD")
3636
if envUin != "" || envPass != "" {
3737
uin, err := strconv.ParseInt(envUin, 10, 64)
3838
if err != nil {

0 commit comments

Comments
 (0)