소스 검색

dsitributor-node image size optiomalization

Leszek Wiesner 3 년 전
부모
커밋
9e677c6eec
2개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 10 10
      distributor-node.Dockerfile
  2. 3 3
      metadata-protobuf/package.json

+ 10 - 10
distributor-node.Dockerfile

@@ -10,16 +10,16 @@ COPY ./package.json package.json
 
 EXPOSE 3334
 
-RUN yarn --frozen-lockfile
-
-RUN yarn workspace @joystream/types build
-RUN yarn workspace @joystream/metadata-protobuf build
-RUN yarn workspace @joystream/distributor-cli build
-
-# Clean unneeded files
-RUN find . -name "node_modules" -type d -prune
-RUN yarn --frozen-lockfile --production
-RUN yarn cache clean
+# Build & cleanup
+# (must be inside a signle "RUN", see: https://stackoverflow.com/questions/40212836/docker-image-larger-than-its-filesystem)
+RUN \
+  yarn --frozen-lockfile &&\
+  yarn workspace @joystream/types build &&\
+  yarn workspace @joystream/metadata-protobuf build &&\
+  yarn workspace @joystream/distributor-cli build &&\
+  find . -name "node_modules" -type d -prune &&\
+  yarn --frozen-lockfile --production &&\
+  yarn cache clean
 
 ENTRYPOINT ["yarn", "joystream-distributor"]
 CMD ["start"]

+ 3 - 3
metadata-protobuf/package.json

@@ -41,7 +41,8 @@
     "long": "^4.0.0",
     "@types/long": "^4.0.1",
     "i18n-iso-countries": "^6.8.0",
-    "iso-639-1": "^2.1.9"
+    "iso-639-1": "^2.1.9",
+    "protobufjs": "^6.11.2"
   },
   "devDependencies": {
     "@types/chai": "^4.2.11",
@@ -51,7 +52,6 @@
     "mocha": "^8.2.1",
     "prettier": "2.0.2",
     "ts-node": "^8.8.1",
-    "typescript": "^4.1.3",
-    "protobufjs": "^6.11.2"
+    "typescript": "^4.1.3"
   }
 }