bitsai / dockerfile
hankchin's picture
Upload 29 files
215707b verified
Raw History Blame Contribute Delete
1.28 kB
# 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"]