Skip to content

Commit

Permalink
refactor: build and bundle docker scripts with webpack (#853)
Browse files Browse the repository at this point in the history
* refactor: build and bundle docker scripts with webpack
BREAKING CHANGE:  JavaScript files from `dist` folder have been moved. See [Migrations / 1.1 to 1.2](https://github.com/intershop/intershop-pwa/blob/develop/docs/guides/migrations.md#11-to-12) for more details.
Co-authored-by: Johannes Metzner <jm@jometzner.de>
  • Loading branch information
dhhyi authored Sep 30, 2021
1 parent 7c0b11a commit 94e7fb9
Show file tree
Hide file tree
Showing 14 changed files with 1,118 additions and 22 deletions.
9 changes: 4 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,11 @@
# from dist/.gitignore
/dist/**/*
!/dist/.gitignore
!/dist/build-ecosystem.js
!/dist/entrypoint.sh
!/dist/healthcheck.js
!/dist/prometheus.js
!/dist/robots.txt
!/dist/server.crt
!/dist/server.js
!/dist/server.key
!/dist/readinessprobe.js
!/dist/livenessprobe.js

# from docs/.gitignore
/docs/compodoc
Expand Down Expand Up @@ -77,6 +72,9 @@
/e2e/cypress/screenshots
/e2e/cypress/logs

# from src/ssr/server-scripts/.gitignore
/src/ssr/server-scripts/ecosystem-ports.json

# from src/app/shell/shared/.gitignore
/src/app/shell/shared/lazy**

Expand Down Expand Up @@ -146,3 +144,4 @@ templates
scripts
!scripts/build*pwa.js
!scripts/init-development-environment.js
!scripts/compile-docker-scripts.js
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ RUN npm run build:multi server
# remove cache check for resources (especially index.html)
# https://github.com/angular/angular/issues/23613#issuecomment-415886919
RUN test "${serviceWorker}" = "true" && sed -i 's/canonicalHash !== cacheBustedHash/false/g' /workspace/dist/browser/ngsw-worker.js || true
RUN node scripts/compile-docker-scripts
COPY dist/* /workspace/dist/

FROM node:14-alpine
RUN npm i -g express express-http-proxy pm2 prom-client
COPY --from=buildstep /workspace/dist /dist
RUN cd dist && npm install
ARG displayVersion=
LABEL displayVersion="${displayVersion}"
ENV DISPLAY_VERSION=${displayVersion} NODE_PATH=/usr/local/lib/node_modules
ENV DISPLAY_VERSION=${displayVersion} NODE_PATH=/dist/node_modules PATH=$PATH:/dist/node_modules/.bin
EXPOSE 4200
RUN mkdir /.pm2 && chmod 777 -Rf /.pm2 && touch /dist/ecosystem.yml && chmod 777 -f /dist/ecosystem.yml
USER nobody
Expand Down
5 changes: 0 additions & 5 deletions dist/.gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/**/*
!.gitignore
!/build-ecosystem.js
!/entrypoint.sh
!/healthcheck.js
!/prometheus.js
!/robots.txt
!/server.crt
!/server.js
!/server.key
!/readinessprobe.js
!/livenessprobe.js
6 changes: 6 additions & 0 deletions docs/guides/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ kb_sync_latest_only

# Migrations

## 1.1 to 1.2

The `dist` folder now only contains results of the build process (except for `healthcheck.js`).
You must **not** edit any file inside that `dist` folder.
Since that would include not being able to change Kubernetes liveness or readiness probes we included SSR container related source code under `src/ssr/server-scripts/`

## 0.31 to 1.0

The Angular configuration mechanism of the Intershop PWA was refactored to support running multiple configurations in one docker image (see [Guide - Multiple Themes](./multiple-themes.md)).
Expand Down
Loading

0 comments on commit 94e7fb9

Please sign in to comment.