Просмотр исходного кода

Merge pull request #3991 from weseek/imprv/build-docker-image

Imprv/build docker image
Yuki Takei 4 лет назад
Родитель
Сommit
8ef2f41dd8
4 измененных файлов с 20 добавлено и 12 удалено
  1. 3 7
      .github/workflows/ci.yml
  2. 15 0
      .github/workflows/release-rc.yml
  3. 0 4
      package.json
  4. 2 1
      packages/app/package.json

+ 3 - 7
.github/workflows/ci.yml

@@ -8,7 +8,6 @@ on:
     paths:
     paths:
       - .github/workflows/ci.yml
       - .github/workflows/ci.yml
       - packages/app/**
       - packages/app/**
-      - packages/app-for-hoisting/**
       - .eslint*
       - .eslint*
       - .prettier*
       - .prettier*
       - .stylelint*
       - .stylelint*
@@ -198,7 +197,6 @@ jobs:
       if: steps.cache-dependencies.outputs.cache-hit != 'true'
       if: steps.cache-dependencies.outputs.cache-hit != 'true'
       run: |
       run: |
         npx lerna bootstrap
         npx lerna bootstrap
-        yarn lerna add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion --scope @growi/app --scope @growi/app-for-hoisting
     - name: Print dependencies
     - name: Print dependencies
       run: |
       run: |
         echo -n "node " && node -v
         echo -n "node " && node -v
@@ -271,17 +269,15 @@ jobs:
     - name: Install dependencies
     - name: Install dependencies
       run: |
       run: |
         npx lerna bootstrap
         npx lerna bootstrap
-        yarn lerna add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs --scope @growi/app --scope @growi/app-for-hoisting
-        yarn lerna add -D react-images@1.0.0 react-motion --scope @growi/app --scope @growi/app-for-hoisting
-        yarn lerna run build --scope @growi/slack
     - name: Print dependencies
     - name: Print dependencies
       run: |
       run: |
         echo -n "node " && node -v
         echo -n "node " && node -v
         echo -n "npm " && npm -v
         echo -n "npm " && npm -v
         yarn list --depth=0
         yarn list --depth=0
-    - name: yarn build:prod:analyze
+    - name: Build
       run: |
       run: |
-        yarn build:prod:analyze
+        yarn lerna run build --scope @growi/slack
+        yarn lerna run build --scope @growi/app
     - name: lerna bootstrap --production
     - name: lerna bootstrap --production
       run: |
       run: |
         npx lerna bootstrap -- --production
         npx lerna bootstrap -- --production

+ 15 - 0
.github/workflows/release-rc.yml

@@ -43,6 +43,14 @@ jobs:
     - name: Set up Docker Buildx
     - name: Set up Docker Buildx
       uses: docker/setup-buildx-action@v1
       uses: docker/setup-buildx-action@v1
 
 
+    - name: Cache Docker layers
+      uses: actions/cache@v2
+      with:
+        path: /tmp/.buildx-cache
+        key: ${{ runner.os }}-buildx-app-${{ github.sha }}
+        restore-keys: |
+          ${{ runner.os }}-buildx-app-
+
     - name: Build and push
     - name: Build and push
       uses: docker/build-push-action@v2
       uses: docker/build-push-action@v2
       with:
       with:
@@ -50,8 +58,15 @@ jobs:
         file: ./docker/Dockerfile
         file: ./docker/Dockerfile
         platforms: linux/amd64
         platforms: linux/amd64
         push: true
         push: true
+        cache-from: type=local,src=/tmp/.buildx-cache
+        cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
         tags: ${{ steps.meta.outputs.tags }}
         tags: ${{ steps.meta.outputs.tags }}
 
 
+    - name: Move cache
+      run: |
+        rm -rf /tmp/.buildx-cache
+        mv /tmp/.buildx-cache-new /tmp/.buildx-cache
+
     - name: Check whether workspace is clean
     - name: Check whether workspace is clean
       run: |
       run: |
         STATUS=`git status --porcelain`
         STATUS=`git status --porcelain`

+ 0 - 4
package.json

@@ -37,15 +37,12 @@
     "build:dev:watch:poll": "npm run build:dev:app:watch:poll",
     "build:dev:watch:poll": "npm run build:dev:app:watch:poll",
     "build:dev": "yarn build:dev:app",
     "build:dev": "yarn build:dev:app",
     "build:slack": "lerna run build --scope @growi/slack",
     "build:slack": "lerna run build --scope @growi/slack",
-    "build:prod:analyze": "cross-env ANALYZE=1 npm run build:prod",
-    "build:prod": "env-cmd -f config/env.prod.js webpack --config config/webpack.prod.js --profile --bail",
     "build": "npm run build:dev:watch",
     "build": "npm run build:dev:watch",
     "build:poll": "npm run build:dev:watch:poll",
     "build:poll": "npm run build:dev:watch:poll",
     "clean:app": "rimraf -- public/js public/styles",
     "clean:app": "rimraf -- public/js public/styles",
     "clean:report": "rimraf -- report",
     "clean:report": "rimraf -- report",
     "clean": "npm-run-all -p clean:*",
     "clean": "npm-run-all -p clean:*",
     "console": "env-cmd -f config/env.dev.js node --experimental-repl-await src/server/console.js",
     "console": "env-cmd -f config/env.dev.js node --experimental-repl-await src/server/console.js",
-    "heroku-postbuild": "sh bin/heroku/install-packages.sh && npm run build:prod",
     "lint:js:fix": "eslint \"**/*.{js,jsx}\" --fix",
     "lint:js:fix": "eslint \"**/*.{js,jsx}\" --fix",
     "lint:js": "eslint \"**/*.{js,jsx}\"",
     "lint:js": "eslint \"**/*.{js,jsx}\"",
     "lint:styles:fix": "stylelint --fix src/client/styles/scss/**/*.scss",
     "lint:styles:fix": "stylelint --fix src/client/styles/scss/**/*.scss",
@@ -60,7 +57,6 @@
     "plugin:def": "node bin/generate-plugin-definitions-source.js",
     "plugin:def": "node bin/generate-plugin-definitions-source.js",
     "prebuild:dev:watch": "npm run prebuild:dev",
     "prebuild:dev:watch": "npm run prebuild:dev",
     "prebuild:dev": "npm run clean:app && env-cmd -f config/env.dev.js npm run plugin:def && env-cmd -f config/env.dev.js npm run resource && yarn build:slack",
     "prebuild:dev": "npm run clean:app && env-cmd -f config/env.dev.js npm run plugin:def && env-cmd -f config/env.dev.js npm run resource && yarn build:slack",
-    "prebuild:prod": "npm run clean && env-cmd -f config/env.prod.js npm run plugin:def && env-cmd -f config/env.prod.js npm run resource",
     "prelint:swagger2openapi": "npm run build:apiv3:jsdoc",
     "prelint:swagger2openapi": "npm run build:apiv3:jsdoc",
     "preserver:prod": "npm run migrate",
     "preserver:prod": "npm run migrate",
     "prestart": "npm run build:prod",
     "prestart": "npm run build:prod",

+ 2 - 1
packages/app/package.json

@@ -3,7 +3,8 @@
   "version": "0.9.0-RC",
   "version": "0.9.0-RC",
   "license": "MIT",
   "license": "MIT",
   "scripts": {
   "scripts": {
-    "build": "cd ../../ && env-cmd -f config/env.prod.js webpack --config config/webpack.prod.js --profile --bail"
+    "build": "cd ../../ && env-cmd -f config/env.prod.js webpack --config config/webpack.prod.js --profile --bail",
+    "prebuild": "cd ../../ && yarn plugin:def && yarn resource"
   },
   },
   "// comments for dependencies": {
   "// comments for dependencies": {
     "openid-client": "Node.js 12 or higher is required for openid-client@3 and above.",
     "openid-client": "Node.js 12 or higher is required for openid-client@3 and above.",