From 149fa3a4e3eb8dc2d5a7593e9115ca1cea0dda1c Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Fri, 30 Jun 2023 18:59:56 +0800 Subject: [PATCH] feat: docker compose logs unified directory Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ deploy.Dockerfile | 34 ---------------------------------- docker-compose.yaml | 12 ++++++------ 3 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 Dockerfile delete mode 100644 deploy.Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..dac90136c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM golang as build + +# go mod Installation source, container environment variable addition will override the default variable value +ENV GO111MODULE=on +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/scripts +RUN chmod +x *.sh + +RUN /bin/sh -c ./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 + + +#set directory to map logs,config file,scripts file. +VOLUME ["/Open-IM-Server/logs/open-im-server","/Open-IM-Server/config","/Open-IM-Server/scripts","/Open-IM-Server/db/sdk"] + +#Copy scriptss files and binary files to the blank image +COPY --from=build /Open-IM-Server/scripts /Open-IM-Server/scripts +COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin + +WORKDIR /Open-IM-Server/scripts + +CMD ["./docker_start_all.sh"] diff --git a/deploy.Dockerfile b/deploy.Dockerfile deleted file mode 100644 index ddf58df32..000000000 --- a/deploy.Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM golang as build - -# go mod Installation source, container environment variable addition will override the default variable value -ENV GO111MODULE=on -ENV GOPROXY=https://goproxy.cn,direct - -# Set up the working directory -WORKDIR /Open-IM-Server - -# add all files to the container -COPY . . - -RUN chmod +x /Open-IM-Server/scripts/*.sh && \ - /bin/sh -c /Open-IM-Server/scripts/build_all_service.sh - -#Blank image Multi-Stage Build -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,scripts file. -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/scripts","/Open-IM-Server/db/sdk"] - -#Copy scripts files and binary files to the blank image -COPY --from=build --chown=root:root /Open-IM-Server/scripts /Open-IM-Server/scripts -COPY --from=build --chown=root:root /Open-IM-Server/bin /Open-IM-Server/bin - -WORKDIR /Open-IM-Server/scripts - -CMD ["/Open-IM-Server/scripts/docker_start_all.sh"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 242ea65a4..8b7fc0328 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -103,7 +103,7 @@ services: image: openim/open_im_server:v3.0.0 container_name: open_im_server volumes: - - ./logs:/Open-IM-Server/logs + - ./logs:/Open-IM-Server/logs/open-im-server - ./config/config.yaml:/Open-IM-Server/config/config.yaml - ./config/notification.yaml:/Open-IM-Server/config/notification.yaml - ${DATA_DIR}/db/sdk:/Open-IM-Server/db/sdk @@ -122,12 +122,12 @@ services: max-size: "1g" max-file: "2" - open_im_chat: - image: openim/open_im_enterprise:v1.0.2 + openim_chat: + image: openim/openim-chat:v1.0 container_name: open_im_enterprise volumes: - - ./logs:/Open-IM-chat/logs - - ./.docker-compose_cfg/config.yaml:/Open-IM-Enterprise/config/config.yaml + - ./logs:/Open-IM-Server/logs/openim-chat + - ./openim-chat/config/config.yaml:/openim-chat/config/config.yaml restart: always depends_on: - mysql @@ -142,7 +142,7 @@ services: max-size: "1g" max-file: "2" environment: - CONFIG_NAME: "/Open-IM-Enterprise" + CONFIG_NAME: "/openim-chat" prometheus: image: prom/prometheus