diff --git a/web/client/Dockerfile b/web/client/Dockerfile index 13ba498..49a32a5 100644 --- a/web/client/Dockerfile +++ b/web/client/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build the React app -FROM node:18-alpine AS build +FROM node:20-alpine AS build WORKDIR /app diff --git a/web/server/Dockerfile b/web/server/Dockerfile index 6b8a8e0..d9aa7ec 100644 --- a/web/server/Dockerfile +++ b/web/server/Dockerfile @@ -1,9 +1,10 @@ # Node.js backend -FROM node:18-alpine +FROM node:20-alpine # Build tools needed for better-sqlite3 native compilation # su-exec for dropping privileges in entrypoint -RUN apk add --no-cache python3 make g++ su-exec +# libstdc++ is kept at runtime (needed by better-sqlite3 native addon) +RUN apk add --no-cache python3 make g++ su-exec libstdc++ WORKDIR /app @@ -12,6 +13,7 @@ COPY package*.json ./ RUN npm install --omit=dev # Remove build tools after install to keep image small +# libstdc++ and su-exec are kept for runtime RUN apk del python3 make g++ COPY . . @@ -26,8 +28,8 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh EXPOSE 3001 -HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 \ - CMD wget -qO /dev/null http://localhost:3001/api/health || exit 1 +HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \ + CMD node -e "require('http').get('http://127.0.0.1:3001/api/health', r => { process.exit(r.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))" ENTRYPOINT ["docker-entrypoint.sh"] CMD ["node", "server.js"]