resume-builder / Dockerfile
anik jha
updated docker to install req.txt
e847b4c
Raw History Blame Contribute Delete
1.49 kB
# Dockerfile for PUBLIC Space
# This loads and runs code from a private HF Space
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install basic dependencies
RUN apt-get update && apt-get install -y \
curl \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libharfbuzz0b \
libffi-dev \
libjpeg-dev \
libopenjp2-7 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python packages needed for loading from private space
RUN pip install --no-cache-dir \
huggingface-hub \
Flask \
dotenv
# Install common dependencies that the loaded app might need
# These will be available when the private space code runs
RUN pip install --no-cache-dir \
google-generativeai \
pypdf2 \
weasyprint \
markdown \
requests \
Pillow
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Create a non-root user
RUN useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app
# Copy only the loader script
COPY app.py .
# Switch to non-root user
USER appuser
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:7860/ping || exit 1
# Run the loader which will download and execute the private space code
CMD ["python", "app.py"]