diamond-in commited on
Commit
4563a46
·
verified ·
1 Parent(s): ff17f29

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -17
Dockerfile CHANGED
@@ -1,11 +1,11 @@
1
- # --- STAGE 1: Build Rust Backend ---
2
- FROM rust:1.84-bookworm AS backend_build
3
  WORKDIR /app
4
  RUN apt-get update && apt-get install -y pkg-config libssl-dev
5
  COPY Cargo.toml ./
6
- # Build dependencies only (caching)
7
  RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release
8
- # Build actual source
9
  COPY src ./src
10
  RUN touch src/main.rs && cargo build --release
11
 
@@ -19,7 +19,6 @@ RUN npm run build
19
 
20
  # --- STAGE 3: Final Runtime (Nix + Agent) ---
21
  FROM debian:bookworm-slim
22
- # Install system tools and browser libs
23
  RUN apt-get update && apt-get install -y \
24
  curl xz-utils wget ca-certificates procps \
25
  libssl3 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
@@ -31,30 +30,19 @@ RUN apt-get update && apt-get install -y \
31
  libxrandr2 libxrender1 libxss1 libxtst6 \
32
  && rm -rf /var/lib/apt/lists/*
33
 
34
- # Setup non-root user for Hugging Face
35
  RUN useradd -m -u 1000 user
36
  USER user
37
  ENV HOME=/home/user
38
  WORKDIR /home/user
39
 
40
- # Install Nix in single-user mode
41
  RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
42
  ENV PATH="/home/user/.nix-profile/bin:${PATH}"
43
  ENV NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz
44
 
45
- # Copy the Rust binary from STAGE 1
46
  COPY --from=backend_build /app/target/release/polymorphic-agent .
47
-
48
- # Copy the Frontend dist from STAGE 2
49
- # Axum will serve this folder
50
  COPY --from=frontend_build /app/frontend/dist ./frontend/dist
51
-
52
- # Create dynamic UI folder for the agent to write to
53
  RUN mkdir -p ./frontend/src/dynamic
54
 
55
- # Set environment variables
56
- ENV PORT=7860
57
  EXPOSE 7860
58
-
59
- # Start the agent
60
  CMD ["./polymorphic-agent"]
 
1
+ # --- STAGE 1: Build Rust Backend (Using Nightly) ---
2
+ FROM rustlang/rust:nightly-bookworm AS backend_build
3
  WORKDIR /app
4
  RUN apt-get update && apt-get install -y pkg-config libssl-dev
5
  COPY Cargo.toml ./
6
+ # Build dependencies
7
  RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release
8
+ # Build source
9
  COPY src ./src
10
  RUN touch src/main.rs && cargo build --release
11
 
 
19
 
20
  # --- STAGE 3: Final Runtime (Nix + Agent) ---
21
  FROM debian:bookworm-slim
 
22
  RUN apt-get update && apt-get install -y \
23
  curl xz-utils wget ca-certificates procps \
24
  libssl3 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
 
30
  libxrandr2 libxrender1 libxss1 libxtst6 \
31
  && rm -rf /var/lib/apt/lists/*
32
 
 
33
  RUN useradd -m -u 1000 user
34
  USER user
35
  ENV HOME=/home/user
36
  WORKDIR /home/user
37
 
38
+ # Install Nix
39
  RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
40
  ENV PATH="/home/user/.nix-profile/bin:${PATH}"
41
  ENV NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz
42
 
 
43
  COPY --from=backend_build /app/target/release/polymorphic-agent .
 
 
 
44
  COPY --from=frontend_build /app/frontend/dist ./frontend/dist
 
 
45
  RUN mkdir -p ./frontend/src/dynamic
46
 
 
 
47
  EXPOSE 7860
 
 
48
  CMD ["./polymorphic-agent"]