ytmp4 / Dockerfile
chipling's picture
Update Dockerfile
88cbdba verified
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker# you will also find guides on how best to write your Dockerfile
FROM python:3.9
# Install Node.js and npm
# Using NodeSource's official script for stable Node.js installation
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -y nodejs
# Create a non-root user and set up environment
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy Python requirements and install them
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy Node.js package files and install dependencies
# Ensure package.json and package-lock.json (if exists) are in the same directory as Dockerfile
COPY --chown=user ./package.json package.json
# If you have a package-lock.json, uncomment the line below:
# COPY --chown=user ./package-lock.json package-lock.json
RUN npm install
# Copy the rest of the application files
COPY --chown=user . /app
# Expose the port FastAPI will listen on
EXPOSE 7860
# Command to run the FastAPI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]