From fa58272978ca169d259a5b42e2d0b3cb104a7210 Mon Sep 17 00:00:00 2001 From: Alex Coseru Date: Tue, 15 Aug 2023 15:00:25 +0300 Subject: [PATCH] reduce docker siz (#709) --- Dockerfile | 21 ++++++++++++++++++--- package.json | 12 ++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19cc595..e85de51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,24 @@ -FROM node:16 +FROM ubuntu:20.04 as base +RUN apt-get update && apt-get -y install bash curl +RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh +RUN bash /tmp/nodesource_setup.sh +RUN apt install nodejs + + + +FROM base as builder +RUN apt-get update && apt-get -y install wget COPY package*.json /usr/src/app/ -WORKDIR /usr/src/app -RUN npm install +WORKDIR /usr/src/app/ +ENV NODE_ENV=production +RUN npm ci + +FROM base as runner +ENV NODE_ENV=production COPY . /usr/src/app +WORKDIR /usr/src/app/ +COPY --from=builder /usr/src/app/node_modules/ /usr/src/app/node_modules/ ENV DEPLOY_SUBGRAPH=true ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"] \ No newline at end of file diff --git a/package.json b/package.json index 3be0850..0d80e4a 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,6 @@ "changelog": "auto-changelog -p" }, "devDependencies": { - "@graphprotocol/graph-cli": "^0.38.0", - "@graphprotocol/graph-ts": "^0.30.0", "@types/chai": "^4.3.5", "@types/chai-spies": "^1.0.3", "@types/mocha": "^10.0.1", @@ -71,14 +69,16 @@ "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", "ts-node-register": "^1.0.0", - "typescript": "^5.0.4" - }, - "dependencies": { - "@oceanprotocol/contracts": "^1.1.14", + "typescript": "^5.0.4", "@oceanprotocol/lib": "^2.7.0", "cross-fetch": "^3.1.6", "ethereumjs-util": "^7.1.5" }, + "dependencies": { + "@oceanprotocol/contracts": "^1.1.14", + "@graphprotocol/graph-cli": "^0.38.0", + "@graphprotocol/graph-ts": "^0.30.0" + }, "repository": { "type": "git", "url": "git+https://github.com/oceanprotocol/ocean-subgraph.git"