pair / Dockerfile
Ikyy's picture
Update Dockerfile
16bbeb7 verified
raw
history blame contribute delete
827 Bytes
# Dockerfile
FROM node:20-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3 \
git \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy root package files and install
COPY package*.json ./
RUN npm install
# Copy server file
COPY server.js ./
# Copy frontend folder
COPY frontend ./frontend
# Build frontend
WORKDIR /app/frontend
RUN npm install && npm run build
# Back to root
WORKDIR /app
# Expose port 7860 (required by Hugging Face)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "require('http').get('http://localhost:7860/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
RUN chmod -R 777 /app
# Start the application
CMD ["npm", "start"]