From cce1a2246c39698ee5819a6a4067ce53ab2d6e3b Mon Sep 17 00:00:00 2001 From: burnettk Date: Mon, 30 Jan 2023 22:35:24 -0500 Subject: [PATCH 1/2] add deps for serve --- spiffworkflow-frontend/.dockerignore | 1 + spiffworkflow-frontend/Dockerfile | 7 ++++ spiffworkflow-frontend/package.justserve.json | 36 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 spiffworkflow-frontend/.dockerignore create mode 100644 spiffworkflow-frontend/package.justserve.json diff --git a/spiffworkflow-frontend/.dockerignore b/spiffworkflow-frontend/.dockerignore new file mode 100644 index 00000000..07e6e472 --- /dev/null +++ b/spiffworkflow-frontend/.dockerignore @@ -0,0 +1 @@ +/node_modules diff --git a/spiffworkflow-frontend/Dockerfile b/spiffworkflow-frontend/Dockerfile index f06ade93..c39c20dc 100644 --- a/spiffworkflow-frontend/Dockerfile +++ b/spiffworkflow-frontend/Dockerfile @@ -12,6 +12,12 @@ FROM base AS setup COPY . /app/ +RUN cp /app/package.json /app/package.json.bak +ADD package.justserve.json /app/package.json +RUN npm ci --ignore-scripts +RUN cp -r /app/node_modules /app/node_modules.justserve +RUN cp /app/package.json.bak /app/package.json + # npm ci because it respects the lock file. # --ignore-scripts because authors can do bad things in postinstall scripts. # https://cheatsheetseries.owasp.org/cheatsheets/NPM_Security_Cheat_Sheet.html @@ -31,5 +37,6 @@ ENV PORT0=7001 COPY --from=setup /app/build /app/build COPY --from=setup /app/bin /app/bin +COPY --from=setup /app/node_modules.justserve /app/node_modules ENTRYPOINT ["/app/bin/boot_server_in_docker"] diff --git a/spiffworkflow-frontend/package.justserve.json b/spiffworkflow-frontend/package.justserve.json new file mode 100644 index 00000000..d78004a3 --- /dev/null +++ b/spiffworkflow-frontend/package.justserve.json @@ -0,0 +1,36 @@ +{ + "name": "spiffworkflow-frontend", + "version": "0.1.0", + "private": true, + "dependencies": { + "serve": "^14.0.0" + }, + "scripts": { + "start": "ESLINT_NO_DEV_ERRORS=true PORT=7001 craco start", + "build": "craco build", + "test": "react-scripts test --coverage", + "t": "npm test -- --watchAll=false", + "eject": "craco eject", + "format": "prettier --write src/**/*.[tj]s{,x}", + "lint": "./node_modules/.bin/eslint src", + "lint:fix": "./node_modules/.bin/eslint --fix src" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} From fb123e12e1298539353acf39f7b9e605d86d476a Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 31 Jan 2023 09:27:02 -0500 Subject: [PATCH 2/2] less annoying file name for autocomplete --- spiffworkflow-frontend/Dockerfile | 2 +- .../{package.justserve.json => justservewebserver.package.json} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename spiffworkflow-frontend/{package.justserve.json => justservewebserver.package.json} (100%) diff --git a/spiffworkflow-frontend/Dockerfile b/spiffworkflow-frontend/Dockerfile index c39c20dc..c777a268 100644 --- a/spiffworkflow-frontend/Dockerfile +++ b/spiffworkflow-frontend/Dockerfile @@ -13,7 +13,7 @@ FROM base AS setup COPY . /app/ RUN cp /app/package.json /app/package.json.bak -ADD package.justserve.json /app/package.json +ADD justservewebserver.package.json /app/package.json RUN npm ci --ignore-scripts RUN cp -r /app/node_modules /app/node_modules.justserve RUN cp /app/package.json.bak /app/package.json diff --git a/spiffworkflow-frontend/package.justserve.json b/spiffworkflow-frontend/justservewebserver.package.json similarity index 100% rename from spiffworkflow-frontend/package.justserve.json rename to spiffworkflow-frontend/justservewebserver.package.json