From 0b17e32b292fc5bf895a23f1e382f6376ff6b007 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 4 Apr 2019 17:49:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3(front)=20build=20frontend=20in=20p?= =?UTF-8?q?roduction=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Dockerfile at root project is used to build the production image. We should build the frontend application in production mode and compress css. --- Dockerfile | 4 ++-- src/frontend/package.json | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a29e1a222a..34759c81bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,8 @@ COPY ./src /app/src/ WORKDIR /app/src/frontend RUN yarn install --frozen-lockfile && \ - yarn build && \ - yarn sass + yarn build-production && \ + yarn sass-production # ---- back-end builder image ---- FROM base as back-builder diff --git a/src/frontend/package.json b/src/frontend/package.json index eb9109b455..98d1481978 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -5,11 +5,13 @@ "main": "sandbox/manage.py", "scripts": { "build": "tsc --noEmit && webpack", + "build-production": "tsc --noEmit && webpack --mode=production", "generate-l10n-template": "rip json2pot 'i18n/js/**/*.json' -o i18n/frontend.pot", "generate-translations": "rip po2json './js/translations/*.po' -o './js/translations' -m './i18n/**/*.json'", "lint": "tslint -c tslint.json 'js/**/*.ts?(x)'", "prettier-write": "prettier --write 'js/**/*.+(ts|tsx|json|js|jsx)' '*.+(ts|tsx|json|js|jsx)' '**/*.+(css|scss)'", "sass": "node-sass --include-path node_modules scss/_main.scss ../richie/static/richie/css/main.css", + "sass-production": "node-sass --include-path node_modules scss/_main.scss --output-style compressed ../richie/static/richie/css/main.css", "test": "jest", "watch-sass": "nodemon -e scss -x 'yarn sass'" },