Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +18 -2
Dockerfile
CHANGED
@@ -9,6 +9,8 @@ RUN apt-get update && \
|
|
9 |
python3 \
|
10 |
python3-pip \
|
11 |
python3-venv \
|
|
|
|
|
12 |
curl \
|
13 |
git \
|
14 |
build-essential \
|
@@ -18,6 +20,9 @@ RUN apt-get update && \
|
|
18 |
apt-get clean && \
|
19 |
rm -rf /var/lib/apt/lists/*
|
20 |
|
|
|
|
|
|
|
21 |
# Give coder user sudo privileges without password for package management
|
22 |
RUN echo "coder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
23 |
|
@@ -29,14 +34,21 @@ RUN mkdir -p /animesh && \
|
|
29 |
RUN mkdir -p /home/coder/.npm-global && \
|
30 |
chown -R coder:coder /home/coder/.npm-global
|
31 |
|
|
|
|
|
|
|
|
|
32 |
# Switch back to coder user
|
33 |
USER coder
|
34 |
|
35 |
# Configure npm to use user-owned global directory
|
36 |
RUN npm config set prefix '/home/coder/.npm-global'
|
37 |
|
38 |
-
# Update PATH to include npm global binaries and local binaries
|
39 |
-
ENV PATH="/home/coder/.npm-global/bin:/home/coder/.local/bin:$PATH"
|
|
|
|
|
|
|
40 |
|
41 |
# Set the working directory
|
42 |
WORKDIR /animesh
|
@@ -44,5 +56,9 @@ WORKDIR /animesh
|
|
44 |
# Expose port for Hugging Face Spaces
|
45 |
EXPOSE 7860
|
46 |
|
|
|
|
|
|
|
|
|
47 |
# Run code-server with proper configuration
|
48 |
CMD ["code-server", "--auth=none", "--bind-addr", "0.0.0.0:7860", "/animesh"]
|
|
|
9 |
python3 \
|
10 |
python3-pip \
|
11 |
python3-venv \
|
12 |
+
python3-full \
|
13 |
+
pipx \
|
14 |
curl \
|
15 |
git \
|
16 |
build-essential \
|
|
|
20 |
apt-get clean && \
|
21 |
rm -rf /var/lib/apt/lists/*
|
22 |
|
23 |
+
# Remove the externally-managed-environment file to allow pip installs
|
24 |
+
RUN rm -f /usr/lib/python*/EXTERNALLY-MANAGED
|
25 |
+
|
26 |
# Give coder user sudo privileges without password for package management
|
27 |
RUN echo "coder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
28 |
|
|
|
34 |
RUN mkdir -p /home/coder/.npm-global && \
|
35 |
chown -R coder:coder /home/coder/.npm-global
|
36 |
|
37 |
+
# Create a Python virtual environment that's always activated
|
38 |
+
RUN python3 -m venv /home/coder/.venv && \
|
39 |
+
chown -R coder:coder /home/coder/.venv
|
40 |
+
|
41 |
# Switch back to coder user
|
42 |
USER coder
|
43 |
|
44 |
# Configure npm to use user-owned global directory
|
45 |
RUN npm config set prefix '/home/coder/.npm-global'
|
46 |
|
47 |
+
# Update PATH to include npm global binaries, venv, and local binaries
|
48 |
+
ENV PATH="/home/coder/.venv/bin:/home/coder/.npm-global/bin:/home/coder/.local/bin:$PATH"
|
49 |
+
|
50 |
+
# Upgrade pip in the virtual environment
|
51 |
+
RUN /home/coder/.venv/bin/pip install --upgrade pip
|
52 |
|
53 |
# Set the working directory
|
54 |
WORKDIR /animesh
|
|
|
56 |
# Expose port for Hugging Face Spaces
|
57 |
EXPOSE 7860
|
58 |
|
59 |
+
# Create a startup script that ensures virtual environment is activated
|
60 |
+
RUN echo '#!/bin/bash\nsource /home/coder/.venv/bin/activate\nexec "$@"' > /home/coder/entrypoint.sh && \
|
61 |
+
chmod +x /home/coder/entrypoint.sh
|
62 |
+
|
63 |
# Run code-server with proper configuration
|
64 |
CMD ["code-server", "--auth=none", "--bind-addr", "0.0.0.0:7860", "/animesh"]
|