Blame Raw
Cohee · 51ad27fb · · 53 lines (1.6 KB)
1 contributor
1FROM node:lts-alpine3.23
2
3# Arguments
4ARG APP_HOME=/home/node/app
5
6# Install system dependencies
7# "Don't rely on the base image for tools; if you call it, you install it." ;)
8RUN apk add --no-cache gcompat tini git git-lfs su-exec shadow dos2unix
9
10# Create app directory and set ownership
11WORKDIR ${APP_HOME}
12RUN chown node:node ${APP_HOME}
13
14# Set NODE_ENV to production
15ENV NODE_ENV=production
16
17# Bundle app source and set ownership
18COPY --chown=node:node . ./
19
20RUN \
21 echo "*** Install npm packages ***" && \
22 npm ci --no-audit --no-fund --loglevel=error --no-progress --omit=dev --ignore-scripts && npm cache clean --force
23
24# Create config directory and link config.yaml. Added hardcoded dirs(constants.js?)
25# that must be present for Non-Root Mode and volumeless docker runs.
26RUN \
27 rm -f "config.yaml" || true && \
28 mkdir -p config data plugins public/scripts/extensions/third-party backups && \
29 chown -R node:node config data plugins public/scripts/extensions/third-party backups && \
30 ln -s "./config/config.yaml" "config.yaml"
31
32# Pre-compile public libraries
33RUN \
34 echo "*** Run Webpack ***" && \
35 node "./docker/build-lib.js"
36
37# Set the entrypoint script and cleanup
38RUN \
39 echo "*** Cleanup ***" && \
40 mv "./docker/docker-entrypoint.sh" "./" && \
41 echo "*** Make docker-entrypoint.sh executable ***" && \
42 chmod +x "./docker-entrypoint.sh" && \
43 echo "*** Convert line endings to Unix format ***" && \
44 dos2unix "./docker-entrypoint.sh" && \
45 rm -rf "./docker"
46
47# Fix extension repos permissions
48RUN git config --global --add safe.directory "*"
49
50EXPOSE 8000
51
52# Ensure proper handling of kernel signals
53ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]