arkleinberg commited on
Commit
6e27220
Β·
verified Β·
1 Parent(s): 620612c

Minimal Docker deployment - clones source from GitHub

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -23
Dockerfile CHANGED
@@ -1,50 +1,47 @@
1
  # ═══════════════════════════════════════════════════════════════════════
2
- # Ark.Alliance.StartupCMS.AI - Minimal HuggingFace Deployment
3
  # ═══════════════════════════════════════════════════════════════════════
4
- # Clones source from GitHub during build, includes Assets for seeding
5
 
 
6
  FROM node:22-alpine AS source-clone
7
  WORKDIR /source
8
  RUN apk add --no-cache git
 
9
 
10
- # Clone source from StartupCMS AI repository
11
- RUN git clone https://github.com/M2H-Machine-to-Human-Race/Ark.Alliance.StartupCms.AI.git /source/startupcms || \
12
- echo "Clone failed - using fallback"
13
-
14
- # Stage 1: Build Frontend
15
  FROM node:22-alpine AS frontend-builder
16
  WORKDIR /app/frontend
17
- COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.UI/package*.json ./ 2>/dev/null || true
18
- COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.UI ./ 2>/dev/null || true
19
- RUN if [ -f "package.json" ]; then npm ci && npm run build; else echo "No frontend package.json found"; fi
20
 
21
- # Stage 2: Build Backend
22
  FROM node:22-alpine AS backend-builder
23
  WORKDIR /app/backend
24
- COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.Backend/package*.json ./ 2>/dev/null || true
25
- COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.Backend ./ 2>/dev/null || true
26
- RUN if [ -f "package.json" ]; then npm ci && npm run build; else echo "No backend package.json found"; fi
27
 
28
- # Stage 3: Production Runtime
29
  FROM node:22-alpine AS production
30
  RUN apk add --no-cache nginx
31
 
32
  WORKDIR /app
33
 
34
  # Copy backend build
35
- COPY --from=backend-builder /app/backend/dist ./dist 2>/dev/null || mkdir -p ./dist
36
- COPY --from=backend-builder /app/backend/node_modules ./node_modules 2>/dev/null || true
37
- COPY --from=backend-builder /app/backend/package.json ./ 2>/dev/null || echo '{"name":"fallback"}' > package.json
38
 
39
- # Copy frontend build
40
- COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html 2>/dev/null || mkdir -p /usr/share/nginx/html
41
 
42
  # Copy nginx config
43
  COPY nginx.conf /etc/nginx/nginx.conf
44
 
45
- # Copy Assets directory for database seeding (from HF Space repo)
46
  RUN mkdir -p ./dist/Assets
47
- COPY Assets ./dist/Assets 2>/dev/null || echo "No assets provided"
48
 
49
  # Create persistent data directory for SQLite
50
  RUN mkdir -p /app/data
@@ -52,7 +49,7 @@ RUN mkdir -p /app/data
52
  # HF Spaces runs as user 1000
53
  RUN chown -R 1000:1000 /app /usr/share/nginx/html /var/lib/nginx /var/log/nginx
54
 
55
- # Environment - database will be seeded on first run
56
  ENV PORT=3085
57
  ENV NODE_ENV=production
58
  ENV DATABASE_TYPE=sqlite
 
1
  # ═══════════════════════════════════════════════════════════════════════
2
+ # Ark.Alliance.StartupCMS.AI - HuggingFace Docker Deployment
3
  # ═══════════════════════════════════════════════════════════════════════
 
4
 
5
+ # Stage 1: Clone source from GitHub
6
  FROM node:22-alpine AS source-clone
7
  WORKDIR /source
8
  RUN apk add --no-cache git
9
+ RUN git clone https://github.com/M2H-Machine-to-Human-Race/Ark.Alliance.StartupCms.AI.git /source/startupcms
10
 
11
+ # Stage 2: Build Frontend
 
 
 
 
12
  FROM node:22-alpine AS frontend-builder
13
  WORKDIR /app/frontend
14
+ COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.UI/package*.json ./
15
+ COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.UI ./
16
+ RUN npm ci && npm run build
17
 
18
+ # Stage 3: Build Backend
19
  FROM node:22-alpine AS backend-builder
20
  WORKDIR /app/backend
21
+ COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.Backend/package*.json ./
22
+ COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.Backend ./
23
+ RUN npm ci && npm run build
24
 
25
+ # Stage 4: Production Runtime
26
  FROM node:22-alpine AS production
27
  RUN apk add --no-cache nginx
28
 
29
  WORKDIR /app
30
 
31
  # Copy backend build
32
+ COPY --from=backend-builder /app/backend/dist ./dist
33
+ COPY --from=backend-builder /app/backend/node_modules ./node_modules
34
+ COPY --from=backend-builder /app/backend/package.json ./
35
 
36
+ # Copy frontend build to nginx
37
+ COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html
38
 
39
  # Copy nginx config
40
  COPY nginx.conf /etc/nginx/nginx.conf
41
 
42
+ # Copy Assets directory for database seeding
43
  RUN mkdir -p ./dist/Assets
44
+ COPY Assets/ ./dist/Assets/
45
 
46
  # Create persistent data directory for SQLite
47
  RUN mkdir -p /app/data
 
49
  # HF Spaces runs as user 1000
50
  RUN chown -R 1000:1000 /app /usr/share/nginx/html /var/lib/nginx /var/log/nginx
51
 
52
+ # Environment variables
53
  ENV PORT=3085
54
  ENV NODE_ENV=production
55
  ENV DATABASE_TYPE=sqlite