Skip to content

Commit fa58272

Browse files
authored
reduce docker siz (#709)
1 parent bc56752 commit fa58272

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

Dockerfile

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
FROM node:16
21

2+
FROM ubuntu:20.04 as base
3+
RUN apt-get update && apt-get -y install bash curl
4+
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
5+
RUN bash /tmp/nodesource_setup.sh
6+
RUN apt install nodejs
7+
8+
9+
10+
FROM base as builder
11+
RUN apt-get update && apt-get -y install wget
312
COPY package*.json /usr/src/app/
4-
WORKDIR /usr/src/app
5-
RUN npm install
13+
WORKDIR /usr/src/app/
14+
ENV NODE_ENV=production
15+
RUN npm ci
16+
617

18+
FROM base as runner
19+
ENV NODE_ENV=production
720
COPY . /usr/src/app
21+
WORKDIR /usr/src/app/
22+
COPY --from=builder /usr/src/app/node_modules/ /usr/src/app/node_modules/
823
ENV DEPLOY_SUBGRAPH=true
924
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
"changelog": "auto-changelog -p"
4747
},
4848
"devDependencies": {
49-
"@graphprotocol/graph-cli": "^0.38.0",
50-
"@graphprotocol/graph-ts": "^0.30.0",
5149
"@types/chai": "^4.3.5",
5250
"@types/chai-spies": "^1.0.3",
5351
"@types/mocha": "^10.0.1",
@@ -71,14 +69,16 @@
7169
"ts-node": "^10.9.1",
7270
"ts-node-dev": "^2.0.0",
7371
"ts-node-register": "^1.0.0",
74-
"typescript": "^5.0.4"
75-
},
76-
"dependencies": {
77-
"@oceanprotocol/contracts": "^1.1.14",
72+
"typescript": "^5.0.4",
7873
"@oceanprotocol/lib": "^2.7.0",
7974
"cross-fetch": "^3.1.6",
8075
"ethereumjs-util": "^7.1.5"
8176
},
77+
"dependencies": {
78+
"@oceanprotocol/contracts": "^1.1.14",
79+
"@graphprotocol/graph-cli": "^0.38.0",
80+
"@graphprotocol/graph-ts": "^0.30.0"
81+
},
8282
"repository": {
8383
"type": "git",
8484
"url": "git+https://github.com/oceanprotocol/ocean-subgraph.git"

0 commit comments

Comments
 (0)