shiftslabs commited on
Commit
07ca0c6
·
verified ·
1 Parent(s): e95ca09

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -14
Dockerfile CHANGED
@@ -1,27 +1,44 @@
1
- FROM oven/bun:latest
 
2
  WORKDIR /app
3
 
4
- # 1. Setup environment and dummy package
5
- RUN echo '{"name":"aionui","type":"module"}' > package.json
6
- RUN bun add express cors dotenv vite @office-ai/platform
7
 
8
- # 2. Copy source
 
 
 
 
 
9
  COPY . .
10
 
11
- # 3. Run AionUi build scripts
12
- # We use 'bun' instead of 'node' to run the script for better compatibility
13
- RUN bun scripts/build-server.mjs
 
 
 
 
14
 
15
- # 4. DEBUG: This will show you in the logs where the files actually are
16
- RUN ls -R dist-server || ls -R dist || echo "Build folder not found"
 
17
 
18
- # 5. Hugging Face Config
 
 
 
 
19
  ENV PORT=7860
20
  ENV NODE_ENV=production
 
21
  ENV DATA_DIR=/data
 
 
22
  RUN mkdir -p /data
 
23
  EXPOSE 7860
24
 
25
- # 6. Start (Trying common AionUi output paths)
26
- # If build-server.mjs creates a different file, we target it here
27
- CMD ["bun", "run", "dist-server/server.mjs"]
 
1
+ # ---- Build Stage ----
2
+ FROM node:20-slim AS builder
3
  WORKDIR /app
4
 
5
+ # Hugging Face doesn't allow 'sudo', but standard 'npm install' works
6
+ RUN npm install -g bun
 
7
 
8
+ # COPY package files separately for layer caching
9
+ # Wildcard '*' prevents build failure if bun.lockb is missing
10
+ COPY package.json bun.lock* ./
11
+ RUN bun install
12
+
13
+ # Copy the entire repo
14
  COPY . .
15
 
16
+ # AionUi build commands strictly as defined in the official repo
17
+ RUN bun run build:renderer:web
18
+ RUN node scripts/build-server.mjs
19
+
20
+ # ---- Runtime Stage ----
21
+ FROM oven/bun:latest AS runtime
22
+ WORKDIR /app
23
 
24
+ # Copy ONLY the artifacts generated in the builder stage
25
+ COPY --from=builder /app/dist-server ./dist-server
26
+ COPY --from=builder /app/out/renderer ./out/renderer
27
 
28
+ # Copy package info for production deps
29
+ COPY package.json bun.lock* ./
30
+ RUN bun install --production
31
+
32
+ # Hugging Face MUST use port 7860
33
  ENV PORT=7860
34
  ENV NODE_ENV=production
35
+ ENV ALLOW_REMOTE=true
36
  ENV DATA_DIR=/data
37
+
38
+ # Create data volume for SQLite persistence
39
  RUN mkdir -p /data
40
+ VOLUME ["/data"]
41
  EXPOSE 7860
42
 
43
+ # Start command targeting the bundled script
44
+ CMD ["bun", "dist-server/server.mjs"]