-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathDockerfile
39 lines (31 loc) · 1.24 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
# Stage frontend
# This describes the stage frontend image, which serves the frontend
# static files, packaged by webpack.
# The build is two-stage, where we build the artifacts in a node container,
# and then only serve them using a simple busybox http server.
# Build this with e.g.: `docker build . -t stage_frontend`
FROM node:18.20.4 as builder
WORKDIR /app
# Install build dependencies up front, so that those layers can still be cached
# if just the frontend source code changes. This will only need to be rebuilt
# when the dependencies themselves change.
COPY package.json /app
COPY package-lock.json /app
RUN --mount=type=cache,target=/app/node_modules \
npm run ci:frontend
# Copy and build the actual resulting artifacts. This places static files
# (js, html) into dist/
COPY . /app
RUN --mount=type=cache,target=/app/node_modules \
npm run build
FROM busybox
RUN adduser -u 1500 -D stage
USER 1500
WORKDIR /home/stage
# For now, we only need the static/ subdirectory. There are other artifacts
# available too, such as /app/dist/appData, but they are currently
# not required.
COPY --from=builder /app/dist/static /home/stage/static
# -f = nodaemon
# -p 8188 = listen on port 8188, all interfaces
CMD ["busybox", "httpd", "-f", "-p", "8188"]