Spaces:
Sleeping
Sleeping
Minimal Docker deployment - clones source from GitHub
Browse files- Dockerfile +20 -23
Dockerfile
CHANGED
|
@@ -1,50 +1,47 @@
|
|
| 1 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 2 |
-
# Ark.Alliance.StartupCMS.AI -
|
| 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 |
-
#
|
| 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 ./
|
| 18 |
-
COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.UI ./
|
| 19 |
-
RUN
|
| 20 |
|
| 21 |
-
# Stage
|
| 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 ./
|
| 25 |
-
COPY --from=source-clone /source/startupcms/Ark.Alliance.StartupCms.Ai.Backend ./
|
| 26 |
-
RUN
|
| 27 |
|
| 28 |
-
# Stage
|
| 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
|
| 36 |
-
COPY --from=backend-builder /app/backend/node_modules ./node_modules
|
| 37 |
-
COPY --from=backend-builder /app/backend/package.json ./
|
| 38 |
|
| 39 |
-
# Copy frontend build
|
| 40 |
-
COPY --from=frontend-builder /app/frontend/dist /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
|
| 46 |
RUN mkdir -p ./dist/Assets
|
| 47 |
-
COPY Assets ./dist/Assets
|
| 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
|
| 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
|