-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (33 loc) · 1.2 KB
/
Dockerfile
File metadata and controls
44 lines (33 loc) · 1.2 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
# Builds production image for collab-server.
# Stage1: Build collab-server
#
FROM node:24-alpine AS builder
WORKDIR /srv/www
# make node_modules cached.
# Src: https://nodesource.com/blog/8-protips-to-start-killing-it-when-dockerizing-node-js/
#
COPY package.json package-lock.json ./
COPY hocuspocus-extension-elasticsearch/package.json ./hocuspocus-extension-elasticsearch/package.json
RUN npm install
# Other files, so that other files do not interfere with node_modules cache
#
COPY . .
RUN npm run build
RUN npm prune --production
# Stage2: Create runner, copy stage1 outputs and other dependencies
#
FROM node:24-alpine
WORKDIR /srv/www
EXPOSE 5001
ENTRYPOINT NODE_ENV=production npm run prod
COPY --from=builder /srv/www/node_modules ./node_modules
COPY --from=builder /srv/www/dist ./dist
# copy monorepo's build outputs
# ref: https://github.com/lerna/lerna/issues/2381
#
COPY --from=builder /srv/www/hocuspocus-extension-elasticsearch/dist ./hocuspocus-extension-elasticsearch/dist
COPY package.json package-lock.json ./
# copy monorepo's package.json
# ref: https://github.com/lerna/lerna/issues/2381
#
COPY hocuspocus-extension-elasticsearch/package.json ./hocuspocus-extension-elasticsearch/package.json