Moondream1cputest / Dockerfile
kwabs22
flagged folder needs hf template to avoid error
032673b
# Use Python 3.9 as the base image
FROM python:3.9
# Set the working directory in the Docker container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
wget \
&& rm -rf /var/lib/apt/lists/*
# [Optional] Add commands to clone and build any necessary projects here
# For example, if you need to build a specific tool or library
# Create a virtual environment and activate it
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Copy the requirements file and install Python dependencies
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
# Create a new user for added security
RUN useradd -m -u 1000 user
# Switch to the non-root user
USER user
# Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
SYSTEM=spaces
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app and set the owner to the user
COPY --chown=user . $HOME/app
# Command to run the application
CMD ["python", "app.py"]