Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1.49 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (32 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Ensure updates are mirrored in `.circleci/config.yml`.
# Always specify a 3-part version, even if it's x.x.0.
FROM node:24.22.2
RUN node --version
WORKDIR /usr/src/app
# Do lib metadata copy + install separately, so this part of the build is cached when only app code changes.
# See https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
COPY package*.json ./
# Prepare FontAwesome config for `npm install`.
ARG FONTAWESOME_NPM_AUTH_TOKEN
COPY .npmrc ./
# Skip Puppeteer Chromium download. https://github.com/puppeteer/puppeteer/issues/2262#issuecomment-407405037
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
RUN npm install
# Now copy the app source
COPY . .
# Take value 'regression', 'staging' or 'production' so we know which Angular vars to build into the app bundle.
# This controls e.g. which environment's API we target.
ARG BUILD_ENV
RUN npm run supportedBrowsers
RUN sed -i "s/GIT_COMMIT_ID/$(git rev-parse --short HEAD)/" src/index.html
RUN sed -i "s/GIT_COMMIT_ID/$(git rev-parse --short HEAD)/" src/index.staging.html
RUN sed -i "s/GIT_COMMIT_ID/$(git rev-parse --short HEAD)/" src/index.regression.html
RUN sed -i "s/GIT_COMMIT_ID/$(git rev-parse --short HEAD)/" src/index.production.html
# Build client bundle and prepare for Server-Side Rendering
RUN npm run build:${BUILD_ENV}
RUN npm run create-legacy-build
EXPOSE 4000
# Behave like a UK visitor when doing e.g. server-side rendering of Date Pipes.
ENV TZ='Europe/London'
# Serve with Server-Side Rendering support
CMD [ "npm", "run", "serve:ssr" ]