mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
chore(nx/docker): basic integration
This commit is contained in:
parent
12977f145c
commit
0e8b1f31b3
@ -23,27 +23,3 @@ RUN npm ci && \
|
||||
# as we install necessary dependencies in runtime buildstage anyways
|
||||
|
||||
# Runtime stage
|
||||
FROM node:22.14.0-alpine
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache su-exec shadow
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY --from=builder /usr/src/app ./
|
||||
|
||||
RUN sed -i "/electron/d" package.json && \
|
||||
npm ci --omit=dev && \
|
||||
node --experimental-strip-types ./bin/cleanupNodeModules.ts . --skip-prune-dev-deps && \
|
||||
npm cache clean --force && \
|
||||
rm -rf \
|
||||
/tmp/node-compile-cache \
|
||||
/usr/src/app/bin/cleanupNodeModules.ts
|
||||
|
||||
# Add application user
|
||||
RUN adduser -s /bin/false node; exit 0
|
||||
|
||||
# Configure container
|
||||
EXPOSE 8080
|
||||
CMD [ "./start-docker.sh" ]
|
||||
HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
|
17
apps/server/Dockerfile
Normal file
17
apps/server/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:22.14.0-alpine
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache su-exec shadow
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY /apps/server/dist /usr/src/app
|
||||
COPY /apps/server/start-docker.sh /usr/src/app
|
||||
|
||||
# Add application user
|
||||
RUN adduser -s /bin/false node; exit 0
|
||||
|
||||
# Configure container
|
||||
EXPOSE 8080
|
||||
CMD [ "sh", "./start-docker.sh" ]
|
||||
HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
|
@ -152,6 +152,12 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"docker-build": {
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"command": "docker build -f apps/server/Dockerfile . -t triliumnext"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,4 +4,4 @@
|
||||
[ ! -z "${USER_GID}" ] && groupmod -og ${USER_GID} node || echo "No USER_GID specified, leaving 1000"
|
||||
|
||||
chown -R node:node /home/node
|
||||
exec su -c "node ./src/main" node
|
||||
exec su -c "node ./main" node
|
Loading…
x
Reference in New Issue
Block a user