diff --git a/Dockerfile b/Dockerfile index 5fcf59809c3c2fc13383f707eaefca25971e5140..15608aae3f9de3f52edd930b8d6e526613da603b 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