无法从 DockerHub 获取 Dockerfile 以在 HuggingFace 空间上工作

cannot get dockerfile from dockerhub to work on huggingface spaces

提问人:Circulartextapps 提问时间:11/16/2023 更新时间:11/16/2023 访问量:28

问:

当我在容器中运行图像时,图像运行良好,但是当它被推到集线器并在我拥抱的脸部空间中使用时,它不起作用 我无法让我在中心中的 docker 映像在我拥抱的脸空间内工作,这是空间内的 dockerfile 将图像推送到中心图像 Hub 中的图像

# Use the circulartextapp/speedinga:1.0 image from the Docker Hub as the base image
FROM circulartextapp/speedtime:latest

# User Setup (if needed)
RUN useradd -m -u 1001 user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1

# Set the working directory in the container to the application directory
WORKDIR /code

# Copy Python requirements file
COPY requirements.txt .

# Copy your application files into the container
COPY . /code


# Expose any ports your application might use (if applicable)
EXPOSE 7860

# Specify the command to run your Node.js application
CMD ["node", "server.js"]

这是 Hf 空间上的错误错误映像,这是我推送到中心的 docker 映像 # 使用基础 Docker 映像 来自 nikolaik/python-nodejs:python3.11-nodejs20

# Set the working directory
WORKDIR /app

# Install system packages including ffmpeg
RUN apt-get update && \
    apt-get install -y ffmpeg && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Copy Python requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt


# Copy Node.js application files
COPY package*.json .

# Install Node.js dependencies
RUN npm install

# Install Node.js dependencies, including Express
RUN npm install express
# Copy the rest of the application code
COPY . .

# Expose the application port
EXPOSE 7860

# Set the default command to start the application
CMD ["npm", "start"]

我使用 express 尝试了这个 witout,但它仍然不起作用,我尝试在空间内的 dockerfile 中运行 express,但随后整个空间在 30 分钟后超时,这就是 huggingface 空间

我尝试将其放入我的原始映像中 # 安装 Node.js 依赖项,包括 Express 运行 npm install express 以及要求和空间映像

python 节点 .js docker huggingface

评论

0赞 TanThien 11/16/2023
我看到步骤,你复制了项目中的所有文件。在您的本地项目中,它有文件夹 ?。如果有,请尝试将忽略添加到 .dockerignore 中,因为您复制并覆盖了映像中的文件夹 node-modulesCOPY . .node-modules
0赞 Circulartextapps 11/17/2023
即使将其添加到原始构建映像中,它仍然在拥抱面部空间时超时 .dockerignore # 节点.js依赖node_modules # Docker 相关文件 Dockerfile .dockerignore # 构建工件 *.pyc *.swp *.log *.tmp pycache

答: 暂无答案