From cbe0c282788b2cd4e69fe53785083d06c77bb6b0 Mon Sep 17 00:00:00 2001 From: llitfkitfk Date: Mon, 23 Mar 2020 14:21:27 +0800 Subject: [PATCH] update: docker build --- Dockerfile | 16 ++-------------- control | 4 ++-- docker-compose.yml | 12 ++++++------ 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index a7924a8a..398ce1d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,19 +8,7 @@ WORKDIR /app # RUN go mod download COPY . . -ENV GOPROXY=https://mod.gokit.info -RUN echo "build monapi" \ - && go build -v -o ./bin/monapi src/modules/monapi/monapi.go \ - && echo "build transfer" \ - && go build -v -o ./bin/transfer src/modules/transfer/transfer.go \ - && echo "build tsdb" \ - && go build -v -o ./bin/tsdb src/modules/tsdb/tsdb.go \ - && echo "build index" \ - && go build -v -o ./bin/index src/modules/index/index.go \ - && echo "build judge" \ - && go build -v -o ./bin/judge src/modules/judge/judge.go \ - && echo "build collector" \ - && go build -v -o ./bin/collector src/modules/collector/collector.go +RUN ./control build FROM alpine:3.10 LABEL maintainer="llitfkitfk@gmail.com" @@ -28,7 +16,7 @@ RUN apk add --no-cache tzdata ca-certificates bash WORKDIR /app -COPY --from=builder /app/etc /app/etc +COPY --from=builder /app/docker/etc /app/etc COPY --from=builder /app/bin /usr/local/bin diff --git a/control b/control index accb98c6..99d6f25e 100755 --- a/control +++ b/control @@ -136,13 +136,13 @@ status() build_one() { mod=$1 - go build -o n9e-${mod} --tags "md5" src/modules/${mod}/${mod}.go + go build -o bin/n9e-${mod} --tags "md5" src/modules/${mod}/${mod}.go } build() { export GO111MODULE=on - export GOPROXY=https://mirrors.aliyun.com/goproxy/ + export GOPROXY=https://mod.gokit.info mod=$1 if [ "x${mod}" = "x" ]; then diff --git a/docker-compose.yml b/docker-compose.yml index 7fde11c5..d2b5e069 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: monapi: image: api restart: always - command: monapi + command: n9e-monapi volumes: - ./docker/etc:/app/etc ports: @@ -26,7 +26,7 @@ services: transfer: image: api restart: always - command: transfer + command: n9e-transfer volumes: - ./docker/etc:/app/etc ports: @@ -36,7 +36,7 @@ services: tsdb: image: api restart: always - command: tsdb + command: n9e-tsdb volumes: - ./docker/etc:/app/etc ports: @@ -46,7 +46,7 @@ services: index: image: api restart: always - command: index + command: n9e-index volumes: - ./docker/etc:/app/etc ports: @@ -56,7 +56,7 @@ services: judge: image: api restart: always - command: judge + command: n9e-judge volumes: - ./docker/etc:/app/etc ports: @@ -66,7 +66,7 @@ services: collector: image: api restart: always - command: collector + command: n9e-collector volumes: - ./docker/etc:/app/etc ports: