Parcourir la source

Update docker images

zhanghongtong il y a 5 ans
Parent
commit
bd7dc39543

+ 2 - 2
.github/workflows/run_fvt_tests.yaml

@@ -187,7 +187,7 @@ jobs:
           sudo ./get_helm.sh
           sudo ./get_helm.sh
           helm version
           helm version
       - name: build kuiper for docker
       - name: build kuiper for docker
-        run: make docker
+        run: sudo docker build --no-cache -t emqx/kuiper:$(git describe --tags --alway)-alpine -f deploy/docker/Dockerfile-alpine .
       - name: run emqx on chart
       - name: run emqx on chart
         env:
         env:
           KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
           KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
@@ -209,7 +209,7 @@ jobs:
           version=$(git describe --tags --always)
           version=$(git describe --tags --always)
           emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
           emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
           
           
-          sudo docker save emqx/kuiper:$version -o kuier.tar.gz
+          sudo docker save emqx/kuiper:$version-alpine -o kuier.tar.gz
           sudo k3s ctr image import kuier.tar.gz
           sudo k3s ctr image import kuier.tar.gz
           
           
           sed -i -r "s/^appVersion: .*$/appVersion: ${version}/g" deploy/chart/kuiper/Chart.yaml
           sed -i -r "s/^appVersion: .*$/appVersion: ${version}/g" deploy/chart/kuiper/Chart.yaml

+ 10 - 3
Makefile

@@ -114,7 +114,8 @@ cross_build: cross_prepare
 .PHONY: docker
 .PHONY: docker
 docker:
 docker:
 	docker build --no-cache -t $(TARGET):$(VERSION) -f deploy/docker/Dockerfile .
 	docker build --no-cache -t $(TARGET):$(VERSION) -f deploy/docker/Dockerfile .
-	docker build --no-cache -t $(TARGET):$(VERSION)-dev -f deploy/docker/Dockerfile-dev .
+	docker build --no-cache -t $(TARGET):$(VERSION)-slim -f deploy/docker/Dockerfile-slim .
+	docker build --no-cache -t $(TARGET):$(VERSION)-alpine -f deploy/docker/Dockerfile-alpine .
 
 
 .PHONY:cross_docker
 .PHONY:cross_docker
 cross_docker: cross_prepare
 cross_docker: cross_prepare
@@ -126,8 +127,14 @@ cross_docker: cross_prepare
 
 
 	docker buildx build --no-cache \
 	docker buildx build --no-cache \
 	--platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/ppc64le \
 	--platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/ppc64le \
-	-t $(TARGET):$(VERSION)-dev \
-	-f deploy/docker/Dockerfile-dev . \
+	-t $(TARGET):$(VERSION)-slim \
+	-f deploy/docker/Dockerfile-slim . \
+	--push
+
+	docker buildx build --no-cache \
+	--platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/ppc64le \
+	-t $(TARGET):$(VERSION)-alpine \
+	-f deploy/docker/Dockerfile-alpine . \
 	--push
 	--push
 
 
 .PHONY: clean
 .PHONY: clean

+ 1 - 1
deploy/chart/kuiper/templates/StatefulSet.yaml

@@ -77,7 +77,7 @@ spec:
       {{- end }}
       {{- end }}
       containers:
       containers:
         - name: kuiper
         - name: kuiper
-          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
+          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}-alpine"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           command: ["./bin/server"]
           command: ["./bin/server"]
           ports:
           ports:

+ 7 - 13
deploy/docker/Dockerfile

@@ -1,24 +1,18 @@
-FROM golang:1.13.10-alpine AS builder
+FROM golang:1.13.10 AS builder
 
 
 COPY . /go/kuiper
 COPY . /go/kuiper
 
 
 WORKDIR /go/kuiper
 WORKDIR /go/kuiper
 
 
-RUN apk add upx gcc make git libc-dev binutils-gold pkgconfig zeromq-dev && make build_with_edgex
-
-FROM alpine:3.10
-
-COPY --from=builder /go/kuiper/_build/kuiper-* /kuiper/
-COPY ./deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
-
-RUN apk add sed libzmq
-
-WORKDIR /kuiper
+RUN apt update && apt install -y upx pkg-config libczmq-dev \
+    && make build_with_edgex \
+    && ln -s /go/kuiper/_build/kuiper-$(git describe --tags --always)-$(uname -s | tr "[A-Z]" "[a-z]")-$(uname -m) /usr/local/kuiper \
+    && ln -s /go/kuiper/deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
 
 
 EXPOSE 9081 20498
 EXPOSE 9081 20498
 
 
-ENV KUIPER_HOME /kuiper
+ENV KUIPER_HOME /usr/local/kuiper
 
 
 ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
 ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
 
 
-CMD ["./bin/server"]
+CMD ["sh", "-c", "cd /usr/local/kuiper && ./bin/server"]

+ 24 - 0
deploy/docker/Dockerfile-alpine

@@ -0,0 +1,24 @@
+FROM golang:1.13.10-alpine AS builder
+
+COPY . /go/kuiper
+
+WORKDIR /go/kuiper
+
+RUN apk add upx gcc make git libc-dev binutils-gold pkgconfig zeromq-dev && make build_with_edgex
+
+FROM alpine:3.10
+
+COPY --from=builder /go/kuiper/_build/kuiper-* /kuiper/
+COPY ./deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
+
+RUN apk add sed libzmq
+
+WORKDIR /kuiper
+
+EXPOSE 9081 20498
+
+ENV KUIPER_HOME /kuiper
+
+ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
+
+CMD ["./bin/server"]

+ 0 - 18
deploy/docker/Dockerfile-dev

@@ -1,18 +0,0 @@
-FROM golang:1.13.10-alpine AS builder
-
-COPY . /go/kuiper
-
-WORKDIR /go/kuiper
-
-RUN apk add vim upx gcc make git sed libc-dev binutils-gold pkgconfig zeromq-dev libzmq \
-    && make build_with_edgex \
-    && ln -s /go/kuiper/_build/kuiper-$(git describe --tags --always)-$(uname -s | tr "[A-Z]" "[a-z]")-$(uname -m) /usr/local/kuiper \
-    && ln -s /go/kuiper/deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
-
-EXPOSE 9081 20498
-
-ENV KUIPER_HOME /usr/local/kuiper
-
-ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
-
-CMD ["sh", "-c", "cd /usr/local/kuiper && ./bin/server"]

+ 24 - 0
deploy/docker/Dockerfile-slim

@@ -0,0 +1,24 @@
+FROM golang:1.13.10 AS builder
+
+COPY . /go/kuiper
+
+WORKDIR /go/kuiper
+
+RUN apt update && apt install -y upx pkg-config libczmq-dev && make build_with_edgex
+
+FROM debian:10
+
+COPY --from=builder /go/kuiper/_build/kuiper-* /kuiper/
+COPY ./deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
+
+RUN apt update && apt install -y pkg-config libczmq-dev
+
+WORKDIR /kuiper
+
+EXPOSE 9081 20498
+
+ENV KUIPER_HOME /kuiper
+
+ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
+
+CMD ["./bin/server"]

Fichier diff supprimé car celui-ci est trop grand
+ 11 - 4
deploy/docker/README.md


+ 1 - 1
deploy/docker/docker-entrypoint.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-if [[ ! -z "$DEBUG" ]]; then
+if [ ! -z "$DEBUG" ]; then
     set -ex
     set -ex
 else
 else
     set -e
     set -e