CoolFace
Apppublic

imkrish/remote-postgres

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
Dockerfile57 linesDownload Raw Back to root
1FROM python:3.11-slim2 3ENV DEBIAN_FRONTEND=noninteractive4 5# PostgreSQL + tools we need at runtime6RUN apt-get update && apt-get install -y --no-install-recommends \7        postgresql postgresql-contrib \8        curl ca-certificates bash \9    && rm -rf /var/lib/apt/lists/*10 11# bore — open-source TCP tunnel, no signup (default). Arch-aware.12RUN ARCH="$(dpkg --print-architecture)" \13    && case "$ARCH" in \14         amd64) BARCH=x86_64 ;; \15         arm64) BARCH=aarch64 ;; \16         *)     BARCH=x86_64 ;; \17       esac \18    && curl -fsSL "https://github.com/ekzhang/bore/releases/download/v0.6.0/bore-v0.6.0-${BARCH}-unknown-linux-musl.tar.gz" \19        -o /tmp/bore.tgz \20    && tar -xzf /tmp/bore.tgz -C /usr/local/bin \21    && rm /tmp/bore.tgz \22    && chmod +x /usr/local/bin/bore23 24# ngrok v3 — optional alternative tunnel (used only if NGROK_AUTHTOKEN is set)25RUN ARCH="$(dpkg --print-architecture)" \26    && curl -fsSL "https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-${ARCH}.tgz" \27        -o /tmp/ngrok.tgz \28    && tar -xzf /tmp/ngrok.tgz -C /usr/local/bin \29    && rm /tmp/ngrok.tgz \30    && chmod +x /usr/local/bin/ngrok31 32# HF Spaces runs the container as uid 1000 — create a matching user33RUN useradd -m -u 1000 appuser34ENV HOME=/home/appuser35 36WORKDIR /app37COPY app/requirements.txt /app/requirements.txt38RUN pip install --no-cache-dir -r /app/requirements.txt39 40COPY app /app41COPY start.sh /app/start.sh42RUN chmod +x /app/start.sh \43    && mkdir -p /home/appuser/data \44    && chown -R appuser:appuser /home/appuser /app45 46USER appuser47 48ENV PGDATA=/home/appuser/data/pgdata \49    POSTGRES_USER=demo \50    POSTGRES_DB=demo \51    PGPORT=5432 \52    APP_PORT=786053 54EXPOSE 786055 56CMD ["/app/start.sh"]57