FROM node:22.20-bookworm-slim ARG NEXT_PUBLIC_VERSION ENV NEXT_PUBLIC_VERSION=$NEXT_PUBLIC_VERSION # Set default env variables for local Postgres & Redis inside the container ENV DATABASE_URL="postgresql://postiz-user:postiz-password@127.0.0.1:5432/postiz-db-local" ENV REDIS_URL="redis://127.0.0.1:6379" ENV JWT_SECRET="huggingface-space-secret-jwt-key" ENV FRONTEND_URL="http://localhost:7860" ENV MAIN_URL="http://localhost:7860" ENV NEXT_PUBLIC_BACKEND_URL="http://localhost:7860/api" ENV BACKEND_INTERNAL_URL="http://localhost:3000" ENV IS_GENERAL="true" ENV DISABLE_REGISTRATION="false" # Avoid interactive prompts from debconf/apt ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ make \ python3-pip \ bash \ nginx \ postgresql \ postgresql-contrib \ redis-server \ git \ && rm -rf /var/lib/apt/lists/* RUN addgroup --system www \ && adduser --system --ingroup www --home /www --shell /usr/sbin/nologin www \ && mkdir -p /www \ && chown -R www:www /www /var/lib/nginx RUN npm --no-update-notifier --no-fund --global install pnpm@10.6.1 pm2 WORKDIR /app COPY . /app COPY var/docker/nginx.conf /etc/nginx/nginx.conf RUN pnpm install # Make scripts executable RUN chmod +x /app/var/docker/start.sh /app/var/docker/backup.sh CMD ["/app/var/docker/start.sh"]