fix: symlink node_modules into .output/server + use curl for healthcheck
- Symlink ensures require('better-sqlite3') resolves from .output/server/
- Install curl for more reliable healthcheck
- Remove NODE_PATH (symlink is more reliable for native modules)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,18 @@
|
|||||||
FROM node:24-alpine
|
FROM node:24-alpine
|
||||||
RUN apk add --no-cache python3 make g++
|
RUN apk add --no-cache python3 make g++ curl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
RUN find node_modules -name "better_sqlite3.node" || (echo "FATAL: binding not found" && exit 1)
|
RUN find node_modules -name "better_sqlite3.node" || (echo "FATAL: binding not found" && exit 1)
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npx nuxt build
|
RUN npx nuxt build
|
||||||
|
# Symlink node_modules into .output/server so external requires resolve
|
||||||
|
RUN ln -s /app/node_modules /app/.output/server/node_modules
|
||||||
RUN apk del make g++ && rm -rf /root/.cache /tmp/*
|
RUN apk del make g++ && rm -rf /root/.cache /tmp/*
|
||||||
RUN mkdir -p /data && chown node:node /data
|
RUN mkdir -p /data && chown node:node /data
|
||||||
USER node
|
USER node
|
||||||
ENV NODE_ENV=production NODE_PATH=/app/node_modules
|
ENV NODE_ENV=production
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
HEALTHCHECK NONE
|
HEALTHCHECK --interval=10s --timeout=5s --retries=10 --start-period=60s \
|
||||||
|
CMD curl -sf http://localhost:3000/api/health || exit 1
|
||||||
ENTRYPOINT ["node", ".output/server/index.mjs"]
|
ENTRYPOINT ["node", ".output/server/index.mjs"]
|
||||||
|
|||||||
Reference in New Issue
Block a user