Update Dockerfile
Browse files- Dockerfile +10 -5
Dockerfile
CHANGED
|
@@ -1,20 +1,25 @@
|
|
| 1 |
# Use python:3.10-slim base
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
git \
|
| 7 |
curl \
|
| 8 |
build-essential \
|
|
|
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
#
|
|
|
|
|
|
|
|
|
|
| 12 |
RUN mkdir -p /opt/data
|
| 13 |
|
| 14 |
-
#
|
| 15 |
RUN useradd -m -u 1000 user
|
| 16 |
|
| 17 |
-
#
|
| 18 |
RUN chown -R user:user /opt/data /home/user
|
| 19 |
|
| 20 |
# Switch to HF user context
|
|
@@ -28,7 +33,7 @@ WORKDIR /home/user/app
|
|
| 28 |
# Clone repo into app folder
|
| 29 |
RUN git clone https://github.com/somratpro/HuggingMes.git /home/user/app
|
| 30 |
|
| 31 |
-
# Install dependencies
|
| 32 |
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
| 33 |
RUN if [ -f package.json ]; then npm install; fi
|
| 34 |
|
|
|
|
| 1 |
# Use python:3.10-slim base
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Install system dependencies (git, curl, build essentials, nodejs, npm)
|
| 5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
git \
|
| 7 |
curl \
|
| 8 |
build-essential \
|
| 9 |
+
nodejs \
|
| 10 |
+
npm \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Pre-install Python PyYAML globally/for user context
|
| 14 |
+
RUN pip install --no-cache-dir pyyaml
|
| 15 |
+
|
| 16 |
+
# Create directory /opt/data while root
|
| 17 |
RUN mkdir -p /opt/data
|
| 18 |
|
| 19 |
+
# Create HF non-root user (UID 1000)
|
| 20 |
RUN useradd -m -u 1000 user
|
| 21 |
|
| 22 |
+
# Give user 1000 ownership over /opt/data and /home/user
|
| 23 |
RUN chown -R user:user /opt/data /home/user
|
| 24 |
|
| 25 |
# Switch to HF user context
|
|
|
|
| 33 |
# Clone repo into app folder
|
| 34 |
RUN git clone https://github.com/somratpro/HuggingMes.git /home/user/app
|
| 35 |
|
| 36 |
+
# Install Python & JS dependencies inside the repo
|
| 37 |
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
| 38 |
RUN if [ -f package.json ]; then npm install; fi
|
| 39 |
|