From 0640d3f0ae7a10d79966643dc75ce92c282abaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20He=C3=9F?= <hessm@t-systems.com> Date: Wed, 10 Jan 2024 10:42:20 +0100 Subject: [PATCH] new version with cloning plugin --- Dockerfile | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5fcf598..15608aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,29 @@ FROM golang AS pluginBuild -ARG pluginname +ARG pluginRepoUrl WORKDIR /app -COPY core/. ../core/ -COPY $pluginname/go.mod $pluginname/go.sum ./ +RUN git clone $pluginRepoUrl . RUN go mod download -COPY $pluginname/. ./ - -RUN CGO_ENABLED=1 GOOS=linux go build -buildmode=plugin -o /plugin +RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -o /plugin FROM golang AS coreBuild -ARG servicename WORKDIR /app -COPY core/. ../core/ -COPY $servicename/go.mod $servicename/go.sum ./ +COPY go.mod go.sum ./ RUN go mod download -COPY $servicename/. ./ +COPY . ./ -RUN CGO_ENABLED=1 GOOS=linux go build -o /$servicename +RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /microservice FROM golang -ARG servicename -ARG serviceport -COPY --from=pluginBuild /plugin /app/ -COPY --from=coreBuild /$servicename /app/ +COPY --from=pluginBuild /plugin /etc/plugins +COPY --from=coreBuild /microservice / -EXPOSE $serviceport +EXPOSE 3000 -ENTRYPOINT [ "/app/$servicename" ] \ No newline at end of file +CMD ["../microservice"] \ No newline at end of file -- GitLab