From b4364a645baa42fdd8444a0dcb0aba99361f2a64 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Fri, 18 Jun 2021 16:03:06 +0800 Subject: [PATCH] add docker config --- .gitignore | 4 +- .idea/runConfigurations/2345.xml | 7 ++ .idea/runConfigurations/2346.xml | 6 ++ .idea/runConfigurations/2347.xml | 6 ++ .idea/runConfigurations/2348.xml | 6 ++ .idea/runConfigurations/2349.xml | 6 ++ .../runConfigurations/docker__Compose_dev.xml | 19 ++++ docker/conf/kafka/server.properties | 2 +- docker/docker-compose.build.yml | 2 +- docker/docker-compose.dev.yml | 86 +++++++++++++++++-- docker/docker-compose.pro.yml | 15 ++-- .../Config/Config.docker.ini | 0 dsBaseRpc/Dockerfile.dev | 22 +++++ .../Config/Config.docker.ini | 2 +- dsBaseWeb/Dockerfile.dev | 22 +++++ .../Config/Config.docker.ini | 0 dsBigData/Dockerfile.dev | 22 +++++ .../dsSso => dsSso}/Config/Config.docker.ini | 0 dsSso/Dockerfile.dev | 23 +++++ .../Config/Config.docker.ini | 0 dsSupport/Dockerfile.dev | 23 +++++ 21 files changed, 252 insertions(+), 21 deletions(-) create mode 100644 .idea/runConfigurations/2345.xml create mode 100644 .idea/runConfigurations/2346.xml create mode 100644 .idea/runConfigurations/2347.xml create mode 100644 .idea/runConfigurations/2348.xml create mode 100644 .idea/runConfigurations/2349.xml create mode 100644 .idea/runConfigurations/docker__Compose_dev.xml rename {docker/conf/dsBaseRpc => dsBaseRpc}/Config/Config.docker.ini (100%) create mode 100644 dsBaseRpc/Dockerfile.dev rename {docker/conf/dsBaseWeb => dsBaseWeb}/Config/Config.docker.ini (98%) create mode 100644 dsBaseWeb/Dockerfile.dev rename {docker/conf/dsBigData => dsBigData}/Config/Config.docker.ini (100%) create mode 100644 dsBigData/Dockerfile.dev rename {docker/conf/dsSso => dsSso}/Config/Config.docker.ini (100%) create mode 100644 dsSso/Dockerfile.dev rename {docker/conf/dsSupport => dsSupport}/Config/Config.docker.ini (100%) create mode 100644 dsSupport/Dockerfile.dev diff --git a/.gitignore b/.gitignore index 10e7f48d..634e57b8 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,6 @@ /dsSupport/WinBuild/ /dsSupport/Logs/ -/dsSdsf/.idea/ \ No newline at end of file +/dsSdsf/.idea/ + +*.log \ No newline at end of file diff --git a/.idea/runConfigurations/2345.xml b/.idea/runConfigurations/2345.xml new file mode 100644 index 00000000..6b8bd746 --- /dev/null +++ b/.idea/runConfigurations/2345.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/2346.xml b/.idea/runConfigurations/2346.xml new file mode 100644 index 00000000..ddc521e4 --- /dev/null +++ b/.idea/runConfigurations/2346.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/2347.xml b/.idea/runConfigurations/2347.xml new file mode 100644 index 00000000..d6b53439 --- /dev/null +++ b/.idea/runConfigurations/2347.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/2348.xml b/.idea/runConfigurations/2348.xml new file mode 100644 index 00000000..ed0d0436 --- /dev/null +++ b/.idea/runConfigurations/2348.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/2349.xml b/.idea/runConfigurations/2349.xml new file mode 100644 index 00000000..cd720814 --- /dev/null +++ b/.idea/runConfigurations/2349.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/docker__Compose_dev.xml b/.idea/runConfigurations/docker__Compose_dev.xml new file mode 100644 index 00000000..6904bd03 --- /dev/null +++ b/.idea/runConfigurations/docker__Compose_dev.xml @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/docker/conf/kafka/server.properties b/docker/conf/kafka/server.properties index f5d6e983..eea6d553 100644 --- a/docker/conf/kafka/server.properties +++ b/docker/conf/kafka/server.properties @@ -3,7 +3,7 @@ node.id=1 controller.quorum.voters=1@localhost:9093 listeners=PLAINTEXT://:9092,CONTROLLER://:9093 inter.broker.listener.name=PLAINTEXT -advertised.listeners=PLAINTEXT://localhost:9092 +advertised.listeners=PLAINTEXT://kafka:9092 controller.listener.names=CONTROLLER listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL num.network.threads=3 diff --git a/docker/docker-compose.build.yml b/docker/docker-compose.build.yml index f6b75872..ee49aeab 100644 --- a/docker/docker-compose.build.yml +++ b/docker/docker-compose.build.yml @@ -1,7 +1,7 @@ version: "3.8" services: build: - image: golang:1.16.4-buster + image: golang:1.16.5-buster volumes: - ../:/go/src environment: diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index cd7f0393..9b15cb69 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -1,19 +1,87 @@ version: "3.8" services: dsbaserpc: + security_opt: + - seccomp:unconfined + cap_add: + - SYS_PTRACE + build: + context: ../dsBaseRpc + dockerfile: Dockerfile.dev + args: + - MODULE=dsBaseRpc + ports: + - 8001:8001 + - 2345:2345 + volumes: + - ../dsBaseRpc/Config/Config.docker.ini:/app/Config/Config.ini + dsbaseweb: cap_add: - SYS_PTRACE security_opt: - - "seccomp:unconfined" + - seccomp:unconfined tty: true stdin_open: true - build: - context: ../dsBaseRpc + build: + context: ../dsBaseWeb + dockerfile: Dockerfile.dev + args: + - MODULE=dsBaseWeb + ports: + - 8002:8002 + - 2346:2345 + volumes: + - ../dsBaseWeb/Config/Config.docker.ini:/app/Config/Config.ini + dsbigdata: + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + tty: true + stdin_open: true + build: + context: ../dsBigData + dockerfile: Dockerfile.dev + args: + - MODULE=dsBigData + ports: + - 8004:8004 + - 2347:2345 + volumes: + - ../dsBigData/Config/Config.docker.ini:/app/Config/Config.ini + dssso: + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + tty: true + stdin_open: true + build: + context: ../dsSso + dockerfile: Dockerfile.dev + args: + - MODULE=dsSso + ports: + - 8004:8004 + - 2348:2345 + volumes: + - ../dsSso/Config/Config.docker.ini:/app/Config/Config.ini + dssupport: + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + tty: true + stdin_open: true + build: + context: ../dsSupport dockerfile: Dockerfile.dev + args: + - MODULE=dsSupport ports: - - 8001:8001 - - 2345:2345 - volumes: - - ../dsBaseRpc:/go/src - - ../dsBaseRpc/Config/Config.ini.docker:/go/src/Config/Config.ini - command: bash -c "cd /go/src && dlv debug --headless --listen=:2345 --api-version=2 --log main.go" \ No newline at end of file + - 8005:8005 + - 2349:2345 + volumes: + - ../dsSupport/Config/Config.docker.ini:/app/Config/Config.ini + depends_on: + - elasticsearch \ No newline at end of file diff --git a/docker/docker-compose.pro.yml b/docker/docker-compose.pro.yml index 85443122..f705988e 100644 --- a/docker/docker-compose.pro.yml +++ b/docker/docker-compose.pro.yml @@ -7,30 +7,29 @@ services: - 8001:8001 volumes: - ./app/dsBaseRpc:/app - - ./conf/dsBaseRpc/Config/Config.docker.ini:/app/Config/Config.ini + - ./app/dsBaseRpc/Config/Config.docker.ini:/app/Config/Config.ini working_dir: /app command: bash -c "./dsBaseRpc" dsbaseweb: image: debian:buster-20210511 - #restart: always + restart: always ports: - 8002:8002 volumes: - ./app/dsBaseWeb:/app - - ./conf/dsBaseWeb/Config/Config.docker.ini:/app/Config/Config.ini + - ./app/dsBaseWeb/Config/Config.docker.ini:/app/Config/Config.ini working_dir: /app command: bash -c "./dsBaseWeb" - #command: tail -f /dev/null depends_on: - kafka dsbigdata: image: debian:buster-20210511 - #restart: always + restart: always ports: - 8004:8004 volumes: - ./app/dsBigData:/app - - ./conf/dsBigData/Config/Config.docker.ini:/app/Config/Config.ini + - ./app/dsBigData/Config/Config.docker.ini:/app/Config/Config.ini working_dir: /app command: bash -c "./dsBigData" depends_on: @@ -42,7 +41,7 @@ services: - 8000:8000 volumes: - ./app/dsSso:/app - - ./conf/dsSso/Config/Config.docker.ini:/app/Config/Config.ini + - ./app/dsSso/Config/Config.docker.ini:/app/Config/Config.ini working_dir: /app command: bash -c "./dsSso" depends_on: @@ -54,7 +53,7 @@ services: - 8005:8005 volumes: - ./app/dsSupport:/app - - ./conf/dsSupport/Config/Config.docker.ini:/app/Config/Config.ini + - ./app/dsSupport/Config/Config.docker.ini:/app/Config/Config.ini working_dir: /app command: bash -c "./dsSupport" depends_on: diff --git a/docker/conf/dsBaseRpc/Config/Config.docker.ini b/dsBaseRpc/Config/Config.docker.ini similarity index 100% rename from docker/conf/dsBaseRpc/Config/Config.docker.ini rename to dsBaseRpc/Config/Config.docker.ini diff --git a/dsBaseRpc/Dockerfile.dev b/dsBaseRpc/Dockerfile.dev new file mode 100644 index 00000000..dc4e7b14 --- /dev/null +++ b/dsBaseRpc/Dockerfile.dev @@ -0,0 +1,22 @@ +FROM golang:1.16.5-buster as build + +RUN go env -w GOPROXY=https://goproxy.cn +RUN go get github.com/go-delve/delve/cmd/dlv + +ARG MODULE +ADD . /go/src/$MODULE +WORKDIR /go/src/$MODULE + +RUN go build -gcflags "all=-N -l" -o /example main.go + +FROM debian:buster-20210511 as Final + +WORKDIR /app +COPY --from=build /go/bin/dlv / +COPY --from=build /example . +COPY Shell . +COPY Config ./Config +#COPY Xml ./Xml +COPY Sql ./Sql + +CMD /dlv --headless --listen=:2345 --api-version=2 --accept-multiclient exec /app/example \ No newline at end of file diff --git a/docker/conf/dsBaseWeb/Config/Config.docker.ini b/dsBaseWeb/Config/Config.docker.ini similarity index 98% rename from docker/conf/dsBaseWeb/Config/Config.docker.ini rename to dsBaseWeb/Config/Config.docker.ini index 67fac300..abeebdf7 100644 --- a/docker/conf/dsBaseWeb/Config/Config.docker.ini +++ b/dsBaseWeb/Config/Config.docker.ini @@ -32,7 +32,7 @@ port = 8002 project_name = dsBaseWeb [kafka] -brokers = kafka:9092, +brokers = kafka:9092 partition = 20 replication = 1 KafkaAccessLogTopic = log_baseweb diff --git a/dsBaseWeb/Dockerfile.dev b/dsBaseWeb/Dockerfile.dev new file mode 100644 index 00000000..59ab89dd --- /dev/null +++ b/dsBaseWeb/Dockerfile.dev @@ -0,0 +1,22 @@ +FROM golang:1.16.5-buster as build + +RUN go env -w GOPROXY=https://goproxy.cn +RUN go get github.com/go-delve/delve/cmd/dlv + +ARG MODULE +ADD . /go/src/$MODULE +WORKDIR /go/src/$MODULE + +RUN go build -gcflags "all=-N -l" -o /example main.go + +FROM debian:buster-20210511 as Final + +WORKDIR /app +COPY --from=build /go/bin/dlv / +COPY --from=build /example . +COPY Shell . +COPY Config ./Config +COPY docs ./docs +#COPY Xml ./Xml + +CMD /dlv --headless --listen=:2345 --api-version=2 --accept-multiclient exec /app/example \ No newline at end of file diff --git a/docker/conf/dsBigData/Config/Config.docker.ini b/dsBigData/Config/Config.docker.ini similarity index 100% rename from docker/conf/dsBigData/Config/Config.docker.ini rename to dsBigData/Config/Config.docker.ini diff --git a/dsBigData/Dockerfile.dev b/dsBigData/Dockerfile.dev new file mode 100644 index 00000000..ebca6d4d --- /dev/null +++ b/dsBigData/Dockerfile.dev @@ -0,0 +1,22 @@ +FROM golang:1.16.5-buster as build + +RUN go env -w GOPROXY=https://goproxy.cn +RUN go get github.com/go-delve/delve/cmd/dlv + +ARG MODULE +ADD . /go/src/$MODULE +WORKDIR /go/src/$MODULE + +RUN go build -gcflags "all=-N -l" -o /example main.go + +FROM debian:buster-20210511 as Final + +WORKDIR /app +COPY --from=build /go/bin/dlv / +COPY --from=build /example . +COPY Shell . +COPY Config ./Config +#COPY Xml ./Xml +#COPY Sql ./Sql + +CMD /dlv --headless --listen=:2345 --api-version=2 --accept-multiclient exec /app/example \ No newline at end of file diff --git a/docker/conf/dsSso/Config/Config.docker.ini b/dsSso/Config/Config.docker.ini similarity index 100% rename from docker/conf/dsSso/Config/Config.docker.ini rename to dsSso/Config/Config.docker.ini diff --git a/dsSso/Dockerfile.dev b/dsSso/Dockerfile.dev new file mode 100644 index 00000000..97c33dec --- /dev/null +++ b/dsSso/Dockerfile.dev @@ -0,0 +1,23 @@ +FROM golang:1.16.5-buster as build + +RUN go env -w GOPROXY=https://goproxy.cn +RUN go get github.com/go-delve/delve/cmd/dlv + +ARG MODULE +ADD . /go/src/$MODULE +WORKDIR /go/src/$MODULE + +RUN go build -gcflags "all=-N -l" -o /example main.go + +FROM debian:buster-20210511 as Final + +WORKDIR /app +COPY --from=build /go/bin/dlv / +COPY --from=build /example . +COPY Shell . +COPY Config ./Config +COPY docs ./docs +#COPY Xml ./Xml +#COPY Sql ./Sql + +CMD /dlv --headless --listen=:2345 --api-version=2 --accept-multiclient exec /app/example \ No newline at end of file diff --git a/docker/conf/dsSupport/Config/Config.docker.ini b/dsSupport/Config/Config.docker.ini similarity index 100% rename from docker/conf/dsSupport/Config/Config.docker.ini rename to dsSupport/Config/Config.docker.ini diff --git a/dsSupport/Dockerfile.dev b/dsSupport/Dockerfile.dev new file mode 100644 index 00000000..97c33dec --- /dev/null +++ b/dsSupport/Dockerfile.dev @@ -0,0 +1,23 @@ +FROM golang:1.16.5-buster as build + +RUN go env -w GOPROXY=https://goproxy.cn +RUN go get github.com/go-delve/delve/cmd/dlv + +ARG MODULE +ADD . /go/src/$MODULE +WORKDIR /go/src/$MODULE + +RUN go build -gcflags "all=-N -l" -o /example main.go + +FROM debian:buster-20210511 as Final + +WORKDIR /app +COPY --from=build /go/bin/dlv / +COPY --from=build /example . +COPY Shell . +COPY Config ./Config +COPY docs ./docs +#COPY Xml ./Xml +#COPY Sql ./Sql + +CMD /dlv --headless --listen=:2345 --api-version=2 --accept-multiclient exec /app/example \ No newline at end of file