victor HF Staff commited on
Commit
e207c78
·
verified ·
1 Parent(s): 3be7d1b

fix: install dependencies as root then chown to bun user

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -14
Dockerfile CHANGED
@@ -1,25 +1,23 @@
1
  # Use official Bun image
2
  FROM oven/bun:1-alpine AS base
3
 
4
- # The bun image already has a user with UID 1000 (bun user)
5
- # Switch to that user for HF Spaces compatibility
6
- USER bun
7
-
8
- # Set environment
9
- ENV HOME=/home/bun \
10
- PATH=/home/bun/.local/bin:$PATH
11
-
12
- # Set working directory
13
- WORKDIR $HOME/app
14
 
15
- # Copy package files first for better caching
16
- COPY --chown=bun package.json bun.lockb ./
17
 
18
- # Install dependencies
19
  RUN bun install --frozen-lockfile --production
20
 
21
  # Copy application files
22
- COPY --chown=bun . .
 
 
 
 
 
 
23
 
24
  # Expose port 7860 (Hugging Face Spaces default)
25
  EXPOSE 7860
 
1
  # Use official Bun image
2
  FROM oven/bun:1-alpine AS base
3
 
4
+ # Set working directory and ensure bun user owns it
5
+ WORKDIR /home/bun/app
 
 
 
 
 
 
 
 
6
 
7
+ # Copy package files first for better caching (as root for now)
8
+ COPY package.json bun.lockb ./
9
 
10
+ # Install dependencies as root (to avoid permission issues)
11
  RUN bun install --frozen-lockfile --production
12
 
13
  # Copy application files
14
+ COPY . .
15
+
16
+ # Change ownership to bun user (UID 1000 for HF Spaces)
17
+ RUN chown -R bun:bun /home/bun/app
18
+
19
+ # Switch to bun user
20
+ USER bun
21
 
22
  # Expose port 7860 (Hugging Face Spaces default)
23
  EXPOSE 7860