Team Ai
Apppublic

darkfire514/PostgreSQL_general

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
Dockerfile65 linesDownload Raw Back to root
1FROM postgres:172 3ARG SOURCE_BRANCH=main4 5ENV SOURCE_BRANCH=${SOURCE_BRANCH} \6    SOURCE_REPOSITORY=CaPaCaptain/PostgreSQL_general_HF \7    POSTGRES_USER=admin \8    POSTGRES_DB=appdb \9    PGDATA=/home/user/pgdata \10    DATA_DIR=/data \11    BACKUP_DIR=/data/backups \12    USER_FILE_DIR=/data/files \13    EXPORT_DIR=/data/exports \14    GENERATED_DIR=/data/generated \15    BACKUP_INTERVAL_SECONDS=3600 \16    ADMINER_VERSION=4.8.1 \17    PATH=/usr/lib/postgresql/17/bin:${PATH}18 19RUN apt-get update && apt-get install -y --no-install-recommends \20    git \21    curl \22    ca-certificates \23    coreutils \24    php-cli \25    php-pgsql \26    php-mysql \27    php-sqlite3 \28    python3 \29    python3-pip \30    procps \31    && rm -rf /var/lib/apt/lists/*32 33RUN curl -L -o /adminer.php \34    https://github.com/vrana/adminer/releases/download/v${ADMINER_VERSION}/adminer-${ADMINER_VERSION}.php35 36WORKDIR /bootstrap37 38# This Space keeps only README.md and this Dockerfile.39# At every container start, fetch the private GitHub repository root into /app,40# remove repository-only files, validate the API routes, and launch the service.41# Use a non-login shell so /etc/profile cannot replace the PostgreSQL image PATH.42CMD ["bash", "-c", "set -euo pipefail; \43  : \"${GITHUB_TOKEN:?GITHUB_TOKEN is required as a Hugging Face Space Secret}\"; \44  : \"${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required as a Hugging Face Space Secret}\"; \45  TOKEN=\"${GITHUB_TOKEN}\"; \46  AUTH=\"$(printf 'x-access-token:%s' \"${TOKEN}\" | base64 | tr -d '\\n')\"; \47  rm -rf /tmp/postgresql-general /app; \48  git -c http.extraHeader=\"Authorization: Basic ${AUTH}\" clone \49    --depth 1 \50    --branch \"${SOURCE_BRANCH}\" \51    \"https://github.com/${SOURCE_REPOSITORY}.git\" \52    /tmp/postgresql-general; \53  mkdir -p /app; \54  cp -a /tmp/postgresql-general/. /app/; \55  rm -rf /tmp/postgresql-general /app/.git /app/HF_files /app/docs; \56  unset GITHUB_TOKEN TOKEN AUTH; \57  python3 -m pip install --break-system-packages --no-cache-dir -r /app/requirements.txt; \58  chmod +x /app/start.sh; \59  python3 -m compileall -q /app; \60  cd /app; \61  python3 -c \"from platform_app.main import app; paths=set(app.openapi().get('paths', {})); required={'/api/health','/admin/projects','/api/flowtrace','/api/flowtrace-portfolio','/api/openclaw/memories','/api/files','/api/rss/articles'}; missing=required-paths; assert not missing, f'missing routes: {sorted(missing)}'; print(f'Validated {len(paths)} API routes')\"; \62  exec /app/start.sh"]63 64EXPOSE 543265EXPOSE 7860