wynai commited on
Commit
9b89fd2
·
verified ·
1 Parent(s): 61a2428

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -0
Dockerfile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python base image as requested
2
+ FROM python:3.12
3
+
4
+ # Install curl, unzip (for Bun), and git
5
+ RUN apt-get update && apt-get install -y curl unzip git && rm -rf /var/lib/apt/lists/*
6
+
7
+ # Install Bun globally
8
+ RUN curl -fsSL https://bun.sh/install | bash
9
+ ENV PATH="/root/.bun/bin:$PATH"
10
+
11
+ # Create a non-root user and switch to it
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV PATH="/home/user/.bun/bin:$PATH"
15
+
16
+ # Set working directory
17
+ WORKDIR /app
18
+
19
+ # Clone the repository into the working directory
20
+ RUN git clone https://github.com/amirkabiri/duckai.git .
21
+
22
+ # Install production dependencies using Bun
23
+ # Use --frozen-lockfile if bun.lock is present and reliable
24
+ RUN bun install --frozen-lockfile --production
25
+
26
+ # Set environment variables for Hugging Face Spaces
27
+ ENV HOST=0.0.0.0
28
+ ENV PORT=7860
29
+
30
+ # Expose the port the app runs on
31
+ EXPOSE 7860
32
+
33
+ # Command to run the application
34
+ # Bun automatically looks for src/server.ts if package.json scripts are set up
35
+ # Explicitly running the file is safer
36
+ CMD ["bun", "run", "src/server.ts"]
37
+