# FROM python:3.9 # # Set working directory # WORKDIR /code # # Copy requirements file # COPY ./requirements.txt /code/requirements.txt # # Install Python dependencies # RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # # Create a non-root user # 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 # # Set working directory for the user # WORKDIR $HOME/app # # Copy application code # COPY --chown=user . $HOME/app # # Run the application # CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] FROM python:3.9 # Set working directory WORKDIR /code1 # Copy requirements file COPY ./requirements.txt /code1/requirements.txt # Install Python dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a non-root user RUN useradd -m -u 1000 user RUN --mount=type=secret,id=EXAMPLE,mode=0444,required=true \ cat /run/secrets/EXAMPLE > /test # Switch to the non-root user USER user # Set environment variables including Hugging Face token ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set working directory for the user WORKDIR $HOME/app1 # Copy application code COPY --chown=user . $HOME/app1 # Run the application CMD ["uvicorn", "main:app1", "--host", "0.0.0.0", "--port", "7860"]