File size: 1,209 Bytes
ebcc4b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
# Multi-stage Dockerfile for LeRobot Arena Frontend
# Stage 1: Build the Svelte application with Bun
FROM oven/bun:1-alpine AS builder

WORKDIR /app

# Install git for dependencies that might need it
RUN apk add --no-cache git

# Copy package files for dependency resolution (better caching)
COPY package.json bun.lock* ./

# Copy local packages that are linked in package.json
COPY packages/ ./packages/

# Install dependencies
RUN bun install --frozen-lockfile

# Copy source code
COPY . .

# Build the static application
RUN bun run build

# Stage 2: Serve with Bun's simple static server
FROM oven/bun:1-alpine AS production

# Set up a new user named "user" with user ID 1000 (required for HF Spaces)
RUN adduser -D -u 1000 user

# Switch to the "user" user
USER user

# Set home to the user's home directory
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory to the user's home directory
WORKDIR $HOME/app

# Copy built application from previous stage with proper ownership
COPY --chown=user --from=builder /app/build ./

# Expose port 7860 (HF Spaces default)
EXPOSE 7860

# Start simple static server using Bun
CMD ["bun", "--bun", "serve", ".", "--port", "7860"]