Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +13 -15
Dockerfile
CHANGED
|
@@ -1,27 +1,23 @@
|
|
| 1 |
# Start from a Node.js base image
|
| 2 |
FROM node:20-slim
|
| 3 |
|
| 4 |
-
# Install system dependencies for Python and
|
| 5 |
-
# We also add 'python3-venv' which is required to create virtual environments
|
| 6 |
RUN apt-get update && apt-get install -y python3-pip python3-venv curl && apt-get clean
|
| 7 |
|
| 8 |
-
# The 'node:20-slim' image already includes a non-root user named 'node'.
|
| 9 |
USER node
|
| 10 |
|
| 11 |
-
# Set the home directory
|
| 12 |
ENV HOME=/home/node
|
| 13 |
|
| 14 |
# Configure npm to use a user-owned directory for global packages
|
| 15 |
ENV NPM_CONFIG_PREFIX=${HOME}/.npm-global
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
# Define the path for our virtual environment
|
| 19 |
ENV VENV_PATH=${HOME}/app/venv
|
| 20 |
-
# Add the virtual environment's bin directory and other paths to the system's PATH.
|
| 21 |
-
# This ensures that when we run 'python' or 'pip', we get the one from our venv.
|
| 22 |
ENV PATH=${VENV_PATH}/bin:${NPM_CONFIG_PREFIX}/bin:${HOME}/.local/bin:${PATH}
|
| 23 |
|
| 24 |
-
# Set the working directory
|
| 25 |
WORKDIR ${HOME}/app
|
| 26 |
|
| 27 |
# Install 'uv', the fast Python package manager
|
|
@@ -30,19 +26,21 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
| 30 |
# Install 'bun' globally into the user's home directory
|
| 31 |
RUN npm install -g bun
|
| 32 |
|
| 33 |
-
#
|
| 34 |
RUN uv venv
|
| 35 |
|
| 36 |
# Copy the Python requirements file
|
| 37 |
COPY --chown=node requirements.txt .
|
| 38 |
-
#
|
| 39 |
-
# Because our PATH is set correctly, 'uv pip' will now automatically use the venv
|
| 40 |
RUN uv pip install -r requirements.txt
|
| 41 |
|
| 42 |
# Copy all other application files
|
| 43 |
COPY --chown=node . .
|
| 44 |
|
| 45 |
-
# Expose the port
|
| 46 |
EXPOSE 7860
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Start from a Node.js base image
|
| 2 |
FROM node:20-slim
|
| 3 |
|
| 4 |
+
# Install system dependencies for Python, venv, and curl
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y python3-pip python3-venv curl && apt-get clean
|
| 6 |
|
| 7 |
+
# The 'node:20-slim' image already includes a non-root user named 'node'.
|
| 8 |
USER node
|
| 9 |
|
| 10 |
+
# Set the home directory
|
| 11 |
ENV HOME=/home/node
|
| 12 |
|
| 13 |
# Configure npm to use a user-owned directory for global packages
|
| 14 |
ENV NPM_CONFIG_PREFIX=${HOME}/.npm-global
|
| 15 |
|
| 16 |
+
# Create and activate a Python virtual environment by adding it to the PATH
|
|
|
|
| 17 |
ENV VENV_PATH=${HOME}/app/venv
|
|
|
|
|
|
|
| 18 |
ENV PATH=${VENV_PATH}/bin:${NPM_CONFIG_PREFIX}/bin:${HOME}/.local/bin:${PATH}
|
| 19 |
|
| 20 |
+
# Set the working directory
|
| 21 |
WORKDIR ${HOME}/app
|
| 22 |
|
| 23 |
# Install 'uv', the fast Python package manager
|
|
|
|
| 26 |
# Install 'bun' globally into the user's home directory
|
| 27 |
RUN npm install -g bun
|
| 28 |
|
| 29 |
+
# Create the virtual environment
|
| 30 |
RUN uv venv
|
| 31 |
|
| 32 |
# Copy the Python requirements file
|
| 33 |
COPY --chown=node requirements.txt .
|
| 34 |
+
# Install packages into the virtual environment
|
|
|
|
| 35 |
RUN uv pip install -r requirements.txt
|
| 36 |
|
| 37 |
# Copy all other application files
|
| 38 |
COPY --chown=node . .
|
| 39 |
|
| 40 |
+
# Expose the port (the port number here is for documentation; the one in the CMD matters)
|
| 41 |
EXPOSE 7860
|
| 42 |
+
|
| 43 |
+
# --- FIX: Add '--host 0.0.0.0' to the startup command ---
|
| 44 |
+
# This tells the server to listen on all network interfaces, not just localhost.
|
| 45 |
+
# We also use ${PORT-7860} to dynamically get the port from Hugging Face.
|
| 46 |
+
CMD npx -y @srbhptl39/mcp-superassistant-proxy@latest --config config.json --host 0.0.0.0 --port ${PORT-7860} --baseUrl $SPACE_HOST
|