diff --git a/Makefile b/Makefile index 496c9166d..f8ec9bb3d 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,10 @@ tidy: vendor: @$(GO) mod vendor +## style: code style -> fmt,vet,lint +.PHONY: style +style: fmt vet lint + ## fmt: Run go fmt against code. .PHONY: fmt fmt: @@ -85,13 +89,9 @@ vet: lint: @$(MAKE) go.lint -## style: code style -> fmt,vet,lint -.PHONY: style -style: fmt vet lint - ## format: Gofmt (reformat) package sources (exclude vendor dir if existed). .PHONY: format -format: +format: @$(MAKE) go.format ## test: Run unit test. diff --git a/deploy.Dockerfile b/deploy.Dockerfile index 2ddc7237c..309e4ba0f 100644 --- a/deploy.Dockerfile +++ b/deploy.Dockerfile @@ -6,34 +6,29 @@ ENV GOPROXY=https://goproxy.cn,direct # Set up the working directory WORKDIR /Open-IM-Server + # add all files to the container COPY . . -WORKDIR /Open-IM-Server/script -RUN chmod +x *.sh - -RUN /bin/sh -c ./build_all_service.sh +RUN chmod +x /Open-IM-Server/script/*.sh && \ + /bin/sh -c /Open-IM-Server/script/build_all_service.sh #Blank image Multi-Stage Build -FROM ubuntu - -RUN rm -rf /var/lib/apt/lists/* -RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\ -&&apt-get install net-tools -#Non-interactive operation -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get install -y vim curl tzdata gawk -#Time zone adjusted to East eighth District -RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata +FROM alpine + +RUN apk add --no-cache vim curl tzdata gawk procps net-tools +#Time zone adjusted to East eighth District +RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + dpkg-reconfigure -f noninteractive tzdata #set directory to map logs,config file,script file. VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"] #Copy script files and binary files to the blank image -COPY --from=build /Open-IM-Server/script /Open-IM-Server/script -COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin +COPY --from=build --chown=root:root /Open-IM-Server/script /Open-IM-Server/script +COPY --from=build --chown=root:root /Open-IM-Server/bin /Open-IM-Server/bin WORKDIR /Open-IM-Server/script -CMD ["./docker_start_all.sh"] +CMD ["/Open-IM-Server/script/docker_start_all.sh"]