File size: 1,278 Bytes
215707b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # Use the official Node.js 18 Alpine image
FROM node:18-alpine
# Set the working directory inside the container
WORKDIR /app
# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init
# Copy only the built application and public assets
COPY dist/claude.js ./
COPY public ./public
# Make the built file executable
RUN chmod +x claude.js
# Create a non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Change ownership of the app directory to the nodejs user
RUN chown -R nodejs:nodejs /app
# Switch to the non-root user
USER nodejs
# Expose the port the app runs on
EXPOSE 9516
# Set environment variables
ENV NODE_ENV=production
ENV PORT=9516
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "const http = require('http'); \
const options = { host: 'localhost', port: process.env.PORT || 9516, path: '/manifest.json', timeout: 2000 }; \
const req = http.request(options, (res) => { \
if (res.statusCode === 200) { process.exit(0); } else { process.exit(1); } \
}); \
req.on('error', () => process.exit(1)); \
req.end();"
# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]
# Start the application
CMD ["./claude.js"] |