forked from Inist-CNRS/lodex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (41 loc) · 1.51 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
FROM node:18.19-alpine AS build
RUN apk add --no-cache make gcc g++ python3 bash git openssh jq
WORKDIR /app
COPY ./package.json /app
COPY ./package-lock.json /app
COPY ./packages /app/packages
RUN npm install --legacy-peer-deps
# see .dockerignore to know all copied files
COPY . /app/
ENV NODE_ENV="production"
ENV CYPRESS_CACHE_FOLDER=/app/.cache
ENV npm_config_cache=/app/.npm
RUN npm run build && \
npm cache clean --force && \
npm run clean && \
npm prune --production --legacy-peer-deps
FROM node:18.19-alpine AS release
RUN apk add --no-cache su-exec redis
# ezmasterizing of lodex
# See https://github.com/Inist-CNRS/ezmaster#ezmasterizing-an-application
# change uid/gid to be compilant with Debian/Ubuntu container (and so with ezmaster-webdav)
RUN echo '{ \
"httpPort": 3000, \
"configPath": "/app/config.json", \
"dataPath": "/app/src/app/custom" \
}' > /etc/ezmaster.json && \
sed -i -e "s/daemon:x:2:2/daemon:x:1:1/" /etc/passwd && \
sed -i -e "s/daemon:x:2:/daemon:x:1:/" /etc/group && \
sed -i -e "s/bin:x:1:1/bin:x:2:2/" /etc/passwd && \
sed -i -e "s/bin:x:1:/bin:x:2:/" /etc/group
COPY --chown=daemon:daemon --from=build /app /app
COPY --chown=daemon:daemon ./config/production-dist.js /app/config/production.js
WORKDIR /app
ENV NODE_ENV="production"
ENV PM2_HOME=/app/.pm2
ENV npm_config_cache=/app/.npm
ENV DEBUG="ezs:*,-ezs:debug,-ezs:trace"
ENV DEBUG_COLORS="0"
EXPOSE 3000
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
CMD ["npx", "pm2-runtime", "ecosystem.config.js"]