Files
Inventory-Manager-CC/web/server/Dockerfile
MayaTheShy a499446366 fix: use wget for Docker health check instead of node
Spawning a full Node process for health checks is slow on Alpine and
can exceed the 3s timeout, causing the container to be marked unhealthy.
Use wget (built into Alpine) instead, and increase start_period to 15s.
2026-03-22 20:42:37 -04:00

34 lines
784 B
Docker

# Node.js backend
FROM node:18-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
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
# Remove build tools after install to keep image small
RUN apk del python3 make g++
COPY . .
# Create data directory for SQLite
RUN mkdir -p /data
VOLUME /data
# Entrypoint fixes /data permissions then drops to node user
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
EXPOSE 3001
HEALTHCHECK --interval=10s --timeout=5s --start_period=15s --retries=3 \
CMD wget -qO- http://localhost:3001/api/health || exit 1
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["node", "server.js"]