Download Dockerfile from tscdev/serv1: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/tscdev/serv1/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/tscdev/serv1/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/tscdev/serv1/resolve/main/Dockerfile
1.4 kB
| # Use Ubuntu as the base image | |
| FROM ubuntu:22.04 | |
| # Set environment variables to prevent prompts during installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Update and install required packages | |
| RUN apt-get update && apt-get install -y \ | |
| python3 python3-pip python3-venv curl wget build-essential && \ | |
| curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Add a new user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set environment variables for the new user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory | |
| WORKDIR /app | |
| # Define arguments for the Node.js file and JSON file | |
| ARG NODE_JS_FILE | |
| ARG JSON_FILE | |
| # Define environment variables for the files | |
| ENV NODE_JS_FILE=${NODE_JS_FILE} | |
| ENV JSON_FILE=${JSON_FILE} | |
| # Copy application code | |
| COPY --chown=user . /app | |
| # Download the Node.js file if specified | |
| RUN if [ -n "${NODE_JS_FILE}" ]; then wget -O /app/script.js "${NODE_JS_FILE}"; fi | |
| # Download the package.json file if specified | |
| RUN if [ -n "${JSON_FILE}" ]; then wget -O /app/package.json "${JSON_FILE}"; fi | |
| # Install Node.js dependencies if package.json exists | |
| RUN if [ -f "/app/package.json" ]; then npm install; fi | |
| # Install global npm dependencies without sudo | |
| # RUN npm install -g ws | |
| EXPOSE 7860 | |
| # Default command to run the application | |
| CMD ["node", "/app/script.js"] | |