Spaces:
Running
Running
File size: 1,400 Bytes
742808b 03a4427 b15a5d2 09e0391 03a4427 b15a5d2 09e0391 03a4427 b15a5d2 03a4427 b15a5d2 03a4427 d6ecdff b15a5d2 ac52c35 03a4427 b15a5d2 09e0391 b15a5d2 09e0391 b15a5d2 09e0391 b15a5d2 742808b |
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# 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"]
|