resonate-api / Dockerfile
Aj0261's picture
chore: setup single container postgres for huggingface spaces
5857d86
Raw History Blame Contribute Delete
863 Bytes
FROM python:3.11.6-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PORT=7860 \
DATA_DIR=/app/data
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
postgresql-client \
postgresql \
&& rm -rf /var/lib/apt/lists/*
# Add postgres binaries to path so user can run initdb/pg_ctl
ENV PATH="/usr/lib/postgresql/15/bin:$PATH"
RUN useradd -m -u 1000 user
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app ./app
COPY data ./data
COPY run.sh .
RUN chmod +x run.sh
# Ensure user owns /app and everything in it
RUN chown -R user:user /app
# Ensure user has access to /var/run/postgresql for sockets
RUN mkdir -p /var/run/postgresql && chown -R user:user /var/run/postgresql
USER user
EXPOSE 7860
CMD ["./run.sh"]