Update Dockerfile
Browse files- Dockerfile +12 -8
Dockerfile
CHANGED
@@ -4,23 +4,29 @@ FROM python:3.12
|
|
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 |
-
#
|
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 |
-
#
|
24 |
RUN bun install --frozen-lockfile --production
|
25 |
|
26 |
# Set environment variables for Hugging Face Spaces
|
@@ -31,7 +37,5 @@ ENV PORT=7860
|
|
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 |
|
|
|
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 |
+
# Create a non-root user
|
|
|
|
|
|
|
|
|
8 |
RUN useradd -m -u 1000 user
|
9 |
+
|
10 |
+
# Switch to the non-root user
|
11 |
USER user
|
12 |
+
|
13 |
+
# Install Bun globally FOR THE USER
|
14 |
+
# It will be installed in /home/user/.bun/bin
|
15 |
+
RUN curl -fsSL https://bun.sh/install | bash
|
16 |
+
|
17 |
+
# Set the PATH environment variable AFTER installing Bun
|
18 |
+
# This ensures subsequent RUN commands find bun
|
19 |
ENV PATH="/home/user/.bun/bin:$PATH"
|
20 |
|
21 |
# Set working directory
|
22 |
WORKDIR /app
|
23 |
|
24 |
# Clone the repository into the working directory
|
25 |
+
# Git clone will run as 'user'
|
26 |
RUN git clone https://github.com/amirkabiri/duckai.git .
|
27 |
|
28 |
# Install production dependencies using Bun
|
29 |
+
# This should now find bun in the PATH set by ENV
|
30 |
RUN bun install --frozen-lockfile --production
|
31 |
|
32 |
# Set environment variables for Hugging Face Spaces
|
|
|
37 |
EXPOSE 7860
|
38 |
|
39 |
# Command to run the application
|
|
|
|
|
40 |
CMD ["bun", "run", "src/server.ts"]
|
41 |
|