File size: 1,487 Bytes
5d68d7e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# ACE Copywriting Pipeline - Optimized for HuggingFace Spaces

FROM node:18-alpine

# Set working directory
WORKDIR /app

# Create user for HuggingFace Spaces (user ID 1000 as required)
# Simple approach: create user with any available UID, HF Spaces will handle the mapping
RUN adduser -D -s /bin/sh user || echo "User already exists"

# Install serve globally for serving static files
RUN npm install -g serve

# Copy package files with proper ownership
COPY --chown=user package*.json ./

# Install dependencies (use npm install since we don't have package-lock.json in git)
RUN npm install

# Copy source code with proper ownership
COPY --chown=user . .

# Set authentication environment variables for build
# These are hashed values so they're safe to include in the build
ENV VITE_AUTH_USERNAME_HASH=d86c4384ddade642a91c5bd72d1e428879a1e94e707b8c7c7f6242ca5f014dc8 \
    VITE_AUTH_PASSWORD_HASH=a8e69ee9f4a340cd9c6264569efb4ecbe5f2ebdaac13313338008be2b7c945d8 \
    VITE_AUTH_USER_ID=1 \
    VITE_AUTH_USER_NAME="ACE Admin" \
    VITE_AUTH_USER_EMAIL=admin@aceui.com

# Build the application
RUN npm run build

# Switch to user (required by HuggingFace Spaces)
USER user

# Set environment variables for HuggingFace Spaces
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Expose port 7860 (required by HuggingFace Spaces)
EXPOSE 7860

# Start the application
CMD ["serve", "-s", "dist", "-l", "7860"]