- Increase start_period from 5s to 10s to allow more time for service initialization - Change health check URL from localhost to 127.0.0.1 for better compatibility
25 lines
443 B
Docker
25 lines
443 B
Docker
FROM node:18-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies for native modules (sqlite3)
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
|
|
# Ensure data directory exists
|
|
RUN mkdir -p data
|
|
|
|
RUN npm run build
|
|
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/health || exit 1
|
|
|
|
CMD ["npm", "start"]
|