FROM alpine:latest # Install postgres database engine, bash, and curl RUN apk add --no-cache postgresql postgresql-contrib bash curl # Download and install the lightweight Bore TCP tunnel agent RUN curl -L https://github.com/ekzhang/bore/releases/download/v0.5.1/bore-v0.5.1-x86_64-unknown-linux-musl.tar.gz | tar -xz -C /usr/local/bin # Set up the unprivileged user account (UID 1000) required by Hugging Face RUN adduser -D -u 1000 hfuser USER hfuser ENV HOME=/home/hfuser WORKDIR $HOME/app # Point database storage directly into your mounted persistent bucket ENV PGDATA=$HOME/app/database_bucket # Expose the mandatory Hugging Face web traffic routing port EXPOSE 7860 # Copy only the startup controller script COPY --chown=hfuser:hfuser start.sh . RUN chmod +x start.sh CMD ["./start.sh"]