File size: 1,070 Bytes
9b89fd2
 
 
 
 
 
d5d53eb
9b89fd2
d5d53eb
 
9b89fd2
d5d53eb
 
 
 
 
 
 
9b89fd2
 
 
 
 
 
d5d53eb
9b89fd2
 
 
d5d53eb
9b89fd2
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python base image as requested
FROM python:3.12

# Install curl, unzip (for Bun), and git
RUN apt-get update && apt-get install -y curl unzip git && rm -rf /var/lib/apt/lists/*

# Create a non-root user
RUN useradd -m -u 1000 user

# Switch to the non-root user
USER user

# Install Bun globally FOR THE USER
# It will be installed in /home/user/.bun/bin
RUN curl -fsSL https://bun.sh/install | bash

# Set the PATH environment variable AFTER installing Bun
# This ensures subsequent RUN commands find bun
ENV PATH="/home/user/.bun/bin:$PATH"

# Set working directory
WORKDIR /app

# Clone the repository into the working directory
# Git clone will run as 'user'
RUN git clone https://github.com/amirkabiri/duckai.git .

# Install production dependencies using Bun
# This should now find bun in the PATH set by ENV
RUN bun install --frozen-lockfile --production

# Set environment variables for Hugging Face Spaces
ENV HOST=0.0.0.0
ENV PORT=7860

# Expose the port the app runs on
EXPOSE 7860

# Command to run the application
CMD ["bun", "run", "src/server.ts"]