From 1955fa65be8e831b10f1f5acb2759b06481ac0dc Mon Sep 17 00:00:00 2001 From: "lin.huang" Date: Mon, 25 Sep 2023 15:50:37 +0800 Subject: [PATCH] change the help charts script --- manifest/build-docker.sh | 6 +++ manifest/dockerfiles/openim-api/Dockerfile | 44 ++++++++++++++++++++++ manifest/helm-charts/services/Chart.yaml | 2 +- manifest/helm-charts/services/values.yaml | 8 ++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100755 manifest/build-docker.sh create mode 100644 manifest/dockerfiles/openim-api/Dockerfile diff --git a/manifest/build-docker.sh b/manifest/build-docker.sh new file mode 100755 index 000000000..fd19121ac --- /dev/null +++ b/manifest/build-docker.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +PROJECT=$1 +DOCKER_IMG=${PROJECT} +docker rmi ${DOCKER_IMG} +docker build -f manifest/dockerfiles/${DOCKER_IMG}/Dockerfile -t ${DOCKER_IMG} . \ No newline at end of file diff --git a/manifest/dockerfiles/openim-api/Dockerfile b/manifest/dockerfiles/openim-api/Dockerfile new file mode 100644 index 000000000..20aed0dc6 --- /dev/null +++ b/manifest/dockerfiles/openim-api/Dockerfile @@ -0,0 +1,44 @@ +# ****************************************************************************** +# 2019 - present Contributed by Apulis Technology (Shenzhen) Co. LTD +# +# This program and the accompanying materials are made available under the +# terms of the MIT License, which is available at +# https://www.opensource.org/licenses/MIT +# +# See the NOTICE file distributed with this work for additional +# information regarding copyright ownership. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: MIT +#******************************************************************************/ + +# build container +FROM golang:1.20-alpine3.18 AS builder +ENV GOPROXY https://goproxy.cn,direct +ENV GOSUMDB=sum.golang.google.cn +ENV GO111MODULE=on + +WORKDIR /openim/openim-server +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories +RUN apk --no-cache add git pkgconfig build-base +ADD go.mod . +ADD go.sum . +RUN go mod download +ADD . . +RUN go build -o cmd/openim-api/openim-api cmd/openim-api/main.go + +# archive container +FROM alpine:3.18 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories +RUN apk --no-cache add ca-certificates libdrm +RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo "Asia/Shanghai" > /etc/timezone \ + && apk del tzdata + +WORKDIR /openim/openim-server/bin +COPY --from=builder /openim/openim-server/cmd/openim-api/openim-api /openim/openim-server/bin/ +ENTRYPOINT ["/openim/openim-server/bin/openim-api"] diff --git a/manifest/helm-charts/services/Chart.yaml b/manifest/helm-charts/services/Chart.yaml index 9cdf11f66..a61c8c2e9 100644 --- a/manifest/helm-charts/services/Chart.yaml +++ b/manifest/helm-charts/services/Chart.yaml @@ -23,7 +23,7 @@ version: 0.1.0 appVersion: 0.1.0 # kube version dependency -kubeVersion: 1.20.x +kubeVersion: 1.26.x # keywords use in search keywords: diff --git a/manifest/helm-charts/services/values.yaml b/manifest/helm-charts/services/values.yaml index 97d356c49..eaa6b21be 100644 --- a/manifest/helm-charts/services/values.yaml +++ b/manifest/helm-charts/services/values.yaml @@ -71,6 +71,14 @@ storage: subPath: config.yaml mountPath: /app/configs/config.yaml +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + + nodeSelector: { archType: amd64 }