Mrgf9993 commited on
Commit
2e3b47f
·
verified ·
1 Parent(s): 1a2cdaa

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -16
Dockerfile CHANGED
@@ -1,36 +1,34 @@
1
- # Use a lightweight Ubuntu base
2
  FROM ubuntu:22.04
3
 
4
- # Avoid prompts from apt
5
  ENV DEBIAN_FRONTEND=noninteractive
 
 
6
 
7
- # 1. Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  curl git unzip xz-utils zip libglu1-mesa python3 python3-pip wget \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # 2. Install VS Code Server (code-server)
13
  RUN curl -fsSL https://code-server.dev/install.sh | sh
14
 
15
- # 3. Install Flutter SDK
16
- RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
17
- ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
18
- RUN flutter doctor
19
 
20
- # 4. Set up a non-root user (Required by Hugging Face)
21
  RUN useradd -m -u 1000 user
 
 
 
22
  USER user
23
- ENV HOME=/home/user
24
- WORKDIR $HOME
 
 
25
 
26
- # 5. Install Python dependencies
27
  COPY --chown=user requirements.txt .
28
  RUN pip3 install --no-cache-dir -r requirements.txt
29
 
30
- # 6. Expose the port Hugging Face expects
31
  EXPOSE 7860
32
 
33
- # 7. Start code-server
34
- # --auth none: No password (protected by HF's own auth)
35
- # --bind-addr: Listen on port 7860
36
  CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "."]
 
 
1
  FROM ubuntu:22.04
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
+ # Essential for Flutter to download tools during build
5
+ ENV PUB_CACHE=/home/user/.pub-cache
6
 
 
7
  RUN apt-get update && apt-get install -y \
8
  curl git unzip xz-utils zip libglu1-mesa python3 python3-pip wget \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Install code-server
12
  RUN curl -fsSL https://code-server.dev/install.sh | sh
13
 
14
+ # Install Flutter in a location where the 'user' will have access
15
+ RUN git clone https://github.com/flutter/flutter.git /opt/flutter
16
+ ENV PATH="/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:${PATH}"
 
17
 
18
+ # Create the user FIRST
19
  RUN useradd -m -u 1000 user
20
+ # Give the user ownership of the flutter folder so it can auto-update/download
21
+ RUN chown -R user:user /opt/flutter
22
+
23
  USER user
24
+ WORKDIR /home/user
25
+
26
+ # Pre-download Flutter dependencies so the container starts faster
27
+ RUN flutter precache
28
 
 
29
  COPY --chown=user requirements.txt .
30
  RUN pip3 install --no-cache-dir -r requirements.txt
31
 
 
32
  EXPOSE 7860
33
 
 
 
 
34
  CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "."]