-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
62 lines (44 loc) · 1.62 KB
/
Dockerfile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM node:20-alpine as BUILD_IMAGE
ARG GIT_COMMIT
ARG WORKBENCH_CLIENT_VERSION
# drop privileges
USER node
RUN mkdir -p /home/node/workbench-client
WORKDIR /home/node/workbench-client
# copy deps specification first
COPY --chown=node package*.json ./
# install deps
RUN npm ci --force
# copy rest of app.
# Doing it like this prevents the container from rebuilding when just the app
# contents change - only when depenencies change are the lower layers invalidated.
# Great for dev work.
COPY --chown=node ./ ./
# change environment version
RUN sed -i "s|<<VERSION_REPLACED_WHEN_BUILT>>|${WORKBENCH_CLIENT_VERSION}|" ./src/environments/environment*.ts
RUN npm run build:ssr
FROM node:20-alpine
ARG GIT_COMMIT
ARG WORKBENCH_CLIENT_VERSION
WORKDIR /home/node/workbench-client
LABEL maintainer="Hudson Newey <neweyh@qut.edu.au>" \
description="Production environment for workbench client server" \
version=${WORKBENCH_CLIENT_VERSION} \
name="Workbench Client" \
vendor="QUT Ecoacoustics" \
url="https://github.com/QutEcoacoustics/workbench-client" \
vsc-url="https://github.com/QutEcoacoustics/workbench-client" \
ref=${GIT_COMMIT} \
schema-version="1.0"
# Add ability to make https wget requests
RUN apk add wget ca-certificates
# drop privileges
USER node
RUN mkdir -p /home/node/workbench-client
WORKDIR /home/node/workbench-client
COPY --from=BUILD_IMAGE /home/node/workbench-client/dist ./dist
COPY --from=BUILD_IMAGE /home/node/workbench-client/package.json ./package.json
EXPOSE 4000
# pre-rendering doesn't appear to work at the moment due to our config setup
# && npm run prerender
CMD [ "npm", "run", "serve:ssr"]