saadpie commited on
Commit
0ef553f
·
verified ·
1 Parent(s): 786c44c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -16
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM python:3.10-slim
2
 
3
- # Install system dependencies (git, curl, build tools, nodejs, npm)
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  git \
6
  curl \
@@ -9,35 +9,40 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
9
  npm \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Pre-install global/base requirements
13
- RUN pip install --no-cache-dir pyyaml jupyterlab
14
 
15
- # Create app & data directories
16
- RUN mkdir -p /opt/huggingmes /opt/data
17
-
18
- # Clone repository into /opt/huggingmes where start.sh expects it
19
  RUN git clone https://github.com/somratpro/HuggingMes.git /opt/huggingmes
20
 
21
- # Install Python package / dependencies if setup.py or requirements.txt exist
 
 
 
 
22
  WORKDIR /opt/huggingmes
23
- RUN if [ -f setup.py ]; then pip install --no-cache-dir -e .; fi
24
- RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
 
 
 
 
25
  RUN if [ -f package.json ]; then npm install; fi
26
 
27
- # Create HF non-root user (UID 1000) and hand over ownership
28
  RUN useradd -m -u 1000 user
29
- RUN chown -R user:user /opt/huggingmes /opt/data /home/user
30
 
31
- # Switch to non-root HF user context
32
  USER user
33
- ENV PATH="/home/user/.local/bin:${PATH}"
34
  ENV HERMES_HOME="/opt/data"
 
35
 
36
  WORKDIR /opt/huggingmes
37
-
38
- # Expose HF default port
39
  EXPOSE 7860
40
 
 
41
  RUN chmod +x start.sh 2>/dev/null || true
42
 
43
  CMD ["/bin/bash", "./start.sh"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  git \
6
  curl \
 
9
  npm \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Pre-create all required directory structures
13
+ RUN mkdir -p /opt/huggingmes /opt/data /opt/hermes
14
 
15
+ # Clone HuggingMes repository into /opt/huggingmes
 
 
 
16
  RUN git clone https://github.com/somratpro/HuggingMes.git /opt/huggingmes
17
 
18
+ # Set up the exact Python venv expected by start.sh at /opt/hermes/.venv
19
+ RUN python3 -m venv /opt/hermes/.venv
20
+ ENV PATH="/opt/hermes/.venv/bin:${PATH}"
21
+
22
+ # Install Python requirements into the venv
23
  WORKDIR /opt/huggingmes
24
+ RUN /opt/hermes/.venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel
25
+ RUN /opt/hermes/.venv/bin/pip install --no-cache-dir pyyaml jupyterlab requests
26
+
27
+ # Install hermes package if setup.py or pyproject.toml exists
28
+ RUN if [ -f setup.py ] || [ -f pyproject.toml ]; then /opt/hermes/.venv/bin/pip install --no-cache-dir -e .; fi
29
+ RUN if [ -f requirements.txt ]; then /opt/hermes/.venv/bin/pip install --no-cache-dir -r requirements.txt; fi
30
  RUN if [ -f package.json ]; then npm install; fi
31
 
32
+ # Create HF non-root user (UID 1000) and grant ownership
33
  RUN useradd -m -u 1000 user
34
+ RUN chown -R user:user /opt/huggingmes /opt/data /opt/hermes /home/user
35
 
36
+ # Switch to HF user context
37
  USER user
38
+ ENV HUGGINGMES_APP_DIR="/opt/huggingmes"
39
  ENV HERMES_HOME="/opt/data"
40
+ ENV PATH="/opt/hermes/.venv/bin:/home/user/.local/bin:${PATH}"
41
 
42
  WORKDIR /opt/huggingmes
 
 
43
  EXPOSE 7860
44
 
45
+ # Ensure start.sh has execution permissions
46
  RUN chmod +x start.sh 2>/dev/null || true
47
 
48
  CMD ["/bin/bash", "./start.sh"]