diff --git a/Dockerfile b/Dockerfile index 0c9efd27..120ddf35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,17 @@ -FROM node:lts - +# Build Stage 1 +# This build created a staging docker image +# +FROM node:lts AS appbuild WORKDIR /usr/src/app +COPY . . +RUN yarn docker-setup +RUN cd ./common/docker +RUN yarn run build:binaries -# install core -RUN mkdir -p common/types -RUN mkdir -p common/sdk -RUN mkdir -p common/protocol - -COPY ./package.json ./ -COPY ./tsconfig.json ./ -COPY ./lerna.json ./ -COPY ./nx.json ./ - -COPY ./common/types/package.json ./common/types/ -COPY ./common/types/tsconfig.json ./common/types/ -COPY ./common/types/scripts ./common/types/scripts -COPY ./common/types/src ./common/types/src - -COPY ./common/sdk/package.json ./common/sdk/ -COPY ./common/sdk/tsconfig.json ./common/sdk/ -COPY ./common/sdk/src ./common/sdk/src - -COPY ./common/protocol/package.json ./common/protocol/ -COPY ./common/protocol/tsconfig.json ./common/protocol/ -COPY ./common/protocol/src ./common/protocol/src +# Build Stage 2 +# This build takes the production build from staging build -RUN mkdir -p integrations/tendermint - -COPY ./integrations/tendermint/package.json ./integrations/tendermint/ -COPY ./integrations/tendermint/tsconfig.json ./integrations/tendermint/ -COPY ./integrations/tendermint/src ./integrations/tendermint/src - -RUN yarn install -RUN yarn setup - -# start core -WORKDIR /usr/src/app/integrations/tendermint -ENTRYPOINT ["yarn", "start"] +FROM node:slim AS runtime +WORKDIR /usr/src/app +COPY --from=appbuild /usr/src/app/common/docker/out/kyve* ./ +CMD ["./kyve-linux-x64"] diff --git a/package.json b/package.json index b66a83eb..368e80ec 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "ts-proto": "^1.159.2" }, "scripts": { - "setup": "lerna clean && yarn install && yarn export-grpc-stubs && lerna run build", + "setup": "lerna clean && yarn install && lerna run build", + "docker-setup": "yarn nx reset && yarn install && lerna run build", "graph": "yarn nx graph", "build": "lerna run build", "build:binaries": "lerna run build:binaries --concurrency 1",