Skip to content

Commit

Permalink
feat: make PWA docker build configuration aware (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi committed Mar 12, 2020
1 parent 01857a2 commit 3af4a1d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ COPY schematics/package.json /workspace/node_modules/intershop-schematics/packag
RUN npm i
COPY src /workspace/src/
COPY tsconfig.app.json tsconfig-es5.app.json tsconfig.json ngsw-config.json browserslist angular.json /workspace/
RUN npm run ng -- build -c production
ARG configuration=production
RUN npm run ng -- build -c ${configuration}
COPY tsconfig.server.json /workspace/
RUN npm run ng -- run intershop-pwa:server:production --bundleDependencies all
RUN npm run ng -- run intershop-pwa:server:${configuration} --bundleDependencies all
COPY webpack.server.config.js server.ts /workspace/
RUN npm run webpack:server
RUN egrep -o '^\s*(mockServerAPI: true|mustMockPaths)' src/environments/environment.prod.ts || rm -Rf dist/browser/assets/mock*
Expand All @@ -17,7 +18,10 @@ COPY dist/entrypoint.sh dist/healthcheck.js dist/server.crt dist/server.key dist
FROM node:12-alpine
COPY --from=buildstep /workspace/dist /dist
ARG displayVersion=
ENV DISPLAY_VERSION=$displayVersion
LABEL displayVersion="${displayVersion}"
ENV DISPLAY_VERSION=${displayVersion}
ARG configuration=production
LABEL configuration="${configuration}"
EXPOSE 4200
USER nobody
HEALTHCHECK --interval=60s --timeout=20s --start-period=2s CMD node /dist/healthcheck.js
Expand Down
11 changes: 10 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
}
],
"sourceMap": true,
"extractCss": true
"serviceWorker": false
},
"es5": {
"tsConfig": "./tsconfig-es5.app.json"
Expand Down Expand Up @@ -140,6 +140,15 @@
"scripts": false,
"styles": true
}
},
"local": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.local.ts"
}
],
"sourceMap": true
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion templates/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
version: "3"
services:
pwa:
build: ..
build:
context: ..
args:
# configuration: local
configuration: production
environment:
- LOGGING=true
- ICM_BASE_URL
Expand All @@ -14,6 +18,7 @@ services:
- pwa
environment:
UPSTREAM_PWA: "http://pwa:4200"
# DEBUG: 1
PWA_1_DOMAIN: "example.com"
# PWA_1_SUBDOMAIN: "www"
# PWA_1_TOPLEVELDOMAIN: "com"
Expand Down

0 comments on commit 3af4a1d

Please sign in to comment.