Optimizing Frontend Dockerfile (#60)

* optimizing frontend dockerfile:
- run install first to cache node_modules
- don't pass node_modules to image
- add only needed files before build

* remove language file generation from build step

Co-authored-by: sua yoo <sua@suayoo.com>
This commit is contained in:
Ilya Kreymer 2021-12-05 18:39:45 -08:00 committed by GitHub
parent d5c665be8e
commit efaaece842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 118 additions and 15 deletions

1
frontend/.dockerignore Normal file
View File

@ -0,0 +1 @@
node_modules/

1
frontend/.gitignore vendored
View File

@ -25,4 +25,3 @@
storybook-static
custom-elements.json
src/__generated__

View File

@ -1,18 +1,20 @@
FROM node:16 as build
WORKDIR /app
COPY . .
# disabled to speed up build, assuming built locally
#RUN yarn
COPY package.json .
COPY yarn.lock .
RUN yarn --frozen-lockfile
COPY *.* ./
COPY src ./src/
COPY scripts ./scripts/
RUN yarn build
FROM nginx
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/nginx.conf.template /etc/nginx/templates/
#COPY ./dist /usr/share/nginx/html
#COPY ./nginx.conf.template /etc/nginx/templates/
COPY ./nginx.conf.template /etc/nginx/templates/
RUN rm /etc/nginx/conf.d/*

View File

@ -14,12 +14,6 @@ Install dependencies:
yarn
```
Generate locale files:
```sh
yarn localize:build
```
Start the dev server:
```sh

View File

@ -19,8 +19,7 @@
},
"scripts": {
"test": "web-test-runner \"src/**/*.test.{ts,js}\" --node-resolve --playwright --browsers chromium",
"prebuild": "del-cli ./dist && npm run env:sync && npm run localize:build",
"prebuild-dev": "npm run localize:build",
"prebuild": "del-cli ./dist && npm run env:sync",
"build": "webpack --config webpack.prod.js",
"build-dev": "webpack --mode development",
"start": "webpack serve --mode=development",

View File

@ -0,0 +1,23 @@
// Do not modify this file by hand!
// Re-generate this file by running lit-localize.
/**
* The locale code that templates in this source code are written in.
*/
export const sourceLocale = `en`;
/**
* The other locale codes that this application is localized into. Sorted
* lexicographically.
*/
export const targetLocales = [
`en-US`,
] as const;
/**
* All valid project locale codes. Sorted lexicographically.
*/
export const allLocales = [
`en`,
`en-US`,
] as const;

View File

@ -0,0 +1,85 @@
// Do not modify this file by hand!
// Re-generate this file by running lit-localize
import {str} from '@lit/localize';
/* eslint-disable no-irregular-whitespace */
/* eslint-disable @typescript-eslint/no-explicit-any */
export const templates = {
's9d8b8aa2b404c2c8': `Settings`,
's9f5a5f23312798f0': `Members`,
'sec0b5ace6765b2a5': str`Successfully invited ${0}`,
's5e155029a998ab6e': `Add Member`,
'sef49aec68fd1dc66': `Name`,
's6b2beba7ab637e9e': `Roles`,
's751678adb0aa2b23': `Member`,
'saae1c70e168b45b4': `Admin`,
's70b4765cad7bc7cf': `Viewer`,
's30b4465e07017074': `Back to members list`,
's049cf53ee4e03bd8': `Add New Member`,
's57ade424d57c6edf': `Sent`,
's686306cdb839fb8d': `Sending...`,
's97ee1bd2cffede65': `Resend verification email`,
'sb64c8390aa317e05': `verified`,
's4b8701e4b2749e82': `unverified`,
'se85a9ddb91124b39': `Account settings`,
'sd1f44f1a8bc20e67': `Email`,
'sff50532a2d85e32e': `Change password`,
'sfee74640068abc13': `Current password`,
's3490e2c8b9ec6ad2': `New password`,
's3794c596ee7964ad': `Update password`,
's2ceb11be2290bb1b': `Cancel`,
's60de4a2ab0305e6f': `Wrong password`,
's3acf6c15de666f7a': `Something went wrong changing password`,
's36443da197811866': `team-member@email.com`,
's3de802d9375580c8': `Can start &amp; configure crawls and invite others`,
's091bfc93121283a6': `Can view crawls`,
's2afc9a717c161490': `Invite`,
's2f30d4261790b785': `Something unexpected went wrong`,
's13786b2be911ee8b': `person@email.com`,
's9ad1286ef798a58d': `Joining as`,
's67a47f83f4c07f04': `Enter your email`,
's115ed3de58eca847': `you@email.com`,
's6880074d73c3156b': `Create a password`,
'sa9d1dd5d6142477d': `Your name`,
'sc90335b573830bad': `Lisa Simpson`,
's137af9f7040dc2d2': `(optional)`,
'sdf57c174052aef12': `Your name will be visible to archive collaborators.`,
's5e6b698a2ec87331': `Sign up`,
'sa2a3411699d81b86': `Invalid email address or password`,
'sec77d4da6a57f2b7': `Page not found`,
's8f392679ac01fa81': `Successfully signed up`,
's694b98572e690336': `Click the link in the verification email we sent you to log in.`,
's67c74844cd95f5fe': `Sign in with password`,
's7d44a141de0e2c9b': `Forgot your password?`,
'sf6e1665c7022a1f8': `Password`,
'scb04435672ac5410': `Log in`,
's9ada74585cd89b16': `Your email address`,
'sb6f5b47cf81180bc': `Request password reset`,
'sbf550ad9b31a5f6d': `Sorry, invalid username or password`,
's43ae2b49c3470555': `Something went wrong, couldn't sign you in`,
'sd3fd65e8d242ed24': `Successfully received your request. You will receive an email to reset your password if your email is found in our system.`,
's6d37a6bebbc3f8a8': `That email is not a valid email address`,
's4bfc62609ee1cee2': `Archives`,
'sb971debc37bf0b54': `Owner`,
's97f86b9ebc519523': `Join archive`,
's90e89da8d3140a87': `This invitation is not valid.`,
's7ebc4f216d73836f': `This verification email is not valid.`,
's95689a99051fa841': `Email address verified`,
's8759f1186d757714': `Log in to continue.`,
's3f35c026ab278525': `Resend password reset email?`,
's00ac24e5b7cc64c2': `Password reset email is not valid. Request a new password reset email`,
's0aaaa9b770ff1a59': `Invalid password`,
's7d90fb0e2d1684a7': str`Sent invite to ${0}`,
's586d6bd2eca2da93': `Users`,
'se5cde7fdda328454': `admin`,
's5b8c89c6fdc51c40': `Invite Users`,
's47d31e4dbe55f7d9': `Browsertrix Cloud`,
's48fd2ebd801bef61': `Your account`,
'sa03807e44737a915': `Log Out`,
'sca974356724f8230': `Log In`,
};