Spaces:
Sleeping
Sleeping
# Use Node.js 18 Alpine as base image | |
FROM node:18-alpine | |
# Set working directory | |
WORKDIR /app | |
# Install system dependencies | |
RUN apk add --no-cache \ | |
postgresql-client \ | |
python3 \ | |
make \ | |
g++ | |
# Copy package files | |
COPY package*.json ./ | |
# Install Node.js dependencies | |
RUN npm ci --only=production | |
# Copy application code | |
COPY . . | |
# Create uploads directories | |
RUN mkdir -p uploads/categories uploads/products uploads/sellers uploads/users | |
# Set environment variables | |
ENV NODE_ENV=production | |
ENV PORT=7860 | |
# Expose port | |
EXPOSE 7860 | |
# Health check | |
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | |
CMD node -e "require('http').get('http://localhost:7860/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" | |
# Start the application | |
CMD ["node", "server.js"] | |