File size: 1,338 Bytes
8af9fb7
 
 
 
 
2f5e032
 
 
 
 
 
 
8af9fb7
 
 
 
 
 
 
daddfb8
 
8af9fb7
 
 
2f5e032
8af9fb7
 
daddfb8
 
8af9fb7
2f5e032
8af9fb7
 
 
daddfb8
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
# ──────────────────────────────────────────────
#  TG Store Β· Dockerfile for Hugging Face Spaces
# ──────────────────────────────────────────────
FROM node:20-slim

# node:20-slim strips CA certificates β€” MongoDB Atlas TLS will fail without this
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
  && rm -rf /var/lib/apt/lists/*

# node:20-slim already ships with a 'node' user at uid 1000
# DO NOT run useradd β€” uid 1000 already exists and will crash the build

WORKDIR /app

# Install dependencies first (better layer caching)
COPY package.json ./
RUN npm install --omit=dev

# Copy application source with correct ownership
COPY --chown=node:node . .

# Hugging Face Spaces requires port 7860
ENV PORT=7860
ENV NODE_OPTIONS=--use-openssl-ca
EXPOSE 7860

# Use the built-in node user (uid 1000) β€” required by HF Spaces
USER node

# HF pings /system to verify the app is alive
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s \
  CMD node -e "require('http').get('http://localhost:7860/system',r=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))"

CMD ["node", "index.js"]