forked from CommunitySolidServer/CommunitySolidServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (37 loc) · 1.68 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
# Build stage
FROM registry.access.redhat.com/ubi8/nodejs-16:latest AS build
## Set current working directory
WORKDIR /opt/app-root/src
## Copy the package.json for audit
COPY package*.json ./
## Copy the dockerfile's context's community server files
COPY . .
## Install and build the Solid community server (prepare script cannot run in wd)
RUN npm ci --unsafe-perm && npm run build
# Runtime stage
FROM registry.access.redhat.com/ubi8/nodejs-16-minimal:latest AS runtime
## Add contact informations for questions about the container
LABEL maintainer="Solid Community Server Docker Image Maintainer <[email protected]>"
## Container config & data dir for volume sharing
## Defaults to filestorage with /data directory (passed through CMD below)
RUN mkdir /opt/app-root/data
## Set current directory
WORKDIR /opt/app-root/src
## Copy runtime files from build stage
COPY --from=build /opt/app-root/src/package.json .
COPY --from=build /opt/app-root/src/bin ./bin
COPY --from=build /opt/app-root/src/config ./config
COPY --from=build /opt/app-root/src/dist ./dist
COPY --from=build /opt/app-root/src/node_modules ./node_modules
COPY --from=build /opt/app-root/src/templates ./templates
## Configure permissions for App Directories & Run Container as Non-Root User
RUN chgrp -R 0 /opt/app-root/data && \
chmod -R g=u /opt/app-root/data
RUN chown -R 1001:0 /opt/app-root/data
USER 1001
## Informs Docker that the container listens on the specified network port at runtime
EXPOSE 3000
## Set command run by the container
ENTRYPOINT [ "node", "bin/server.js" ]
## By default run in filemode (overriden if passing alternative arguments)
CMD [ "-c", "config/file.json", "-f", "/opt/app-root/data" ]