Spaces:
Sleeping
Sleeping
File size: 1,137 Bytes
bf313df 3ffaf7a bf313df 3ffaf7a bf313df 3ffaf7a bf313df 3ffaf7a 3acf31d 3ffaf7a bf313df 3ffaf7a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# Use an official Python runtime as a parent image
FROM python:3.8-slim
# Create a non-root user
RUN useradd -m -u 1000 user
# Set the working directory in the container
WORKDIR /app
# Install system packages and Node.js as root first
RUN apt-get update && apt-get install -y \
curl \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install nport globally
RUN npm install -g nport
# Copy the current directory contents into the container at /app
COPY . /app
# Change ownership of the app directory to the user
RUN chown -R user:user /app
# Switch to the non-root user
USER user
# Set PATH to include user's local bin directory
ENV PATH="/home/user/.local/bin:${PATH}"
# Install Python packages as the user (using --user flag)
RUN pip install --user --no-cache-dir -r requirements.txt
# Expose port 7860 (Hugging Face Spaces default port)
EXPOSE 7860
# Define environment variable for Flask
ENV FLASK_APP=AgriGo/app.py
# Run the application on port 7860 for Hugging Face Spaces
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"] |