ImageDeduper / Dockerfile
basilbenny1002's picture
Upload Dockerfile
1ba4316 verified
raw
history blame contribute delete
973 Bytes
# Use Python 3.12 slim image
FROM python:3.12-slim
# Install git (needed for pip install from github)
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy requirements first for better caching
COPY --chown=user requirements.txt .
# Upgrade pip and install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY --chown=user . .
# Expose port 7860 (HuggingFace Spaces default)
EXPOSE 7860
# Run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]