Files
screenshot-tools/Dockerfile
Frank John Begornia 4b7d43efc2
All checks were successful
Deploy Production (ss-tools.crewsportswear.app) / deploy (push) Successful in 2m47s
Update server port to 80 and enhance health check configuration in Docker setup
2025-12-31 02:58:44 +08:00

45 lines
976 B
Docker

FROM node:18-alpine
# Install dependencies for Puppeteer
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont \
wget
# Tell Puppeteer to skip installing Chrome. We'll use the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Create app directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy application files
COPY . .
# Create output directory for screenshots
RUN mkdir -p /var/www/html/images && \
chown -R node:node /var/www/html/images
# Use non-root user
USER node
# Expose port
EXPOSE 5955
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:5955/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
# Start application
CMD ["node", "server.js"]