Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

1.9 KB
Raw Blame
# documentation: https://forgejo.org/docs
# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
# category: git
# tags: version control, collaboration, code, hosting, lightweight, postgresql
# logo: svgs/forgejo.svg
# port: 3000

services:
  forgejo:
    image: codeberg.org/forgejo/forgejo:15
    environment:
      - SERVICE_URL_FORGEJO_3000
      - FORGEJO__server__ROOT_URL=${SERVICE_URL_FORGEJO}
      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
      - FORGEJO__server__DOMAIN=${SERVICE_FQDN_FORGEJO}
      - FORGEJO__server__SSH_DOMAIN=${SERVICE_FQDN_FORGEJO}
      - FORGEJO__server__SSH_PORT=${FORGEJO_SSH_PORT:-22222}
      - USER_UID=1000
      - USER_GID=1000
      - FORGEJO__database__DB_TYPE=postgres
      - FORGEJO__database__HOST=postgresql
      - FORGEJO__database__NAME=${POSTGRESQL_DATABASE:-forgejo}
      - FORGEJO__database__USER=$SERVICE_USER_POSTGRESQL
      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_POSTGRESQL
    volumes:
      - forgejo-data:/data
      - forgejo-timezone:/etc/timezone:ro
      - forgejo-localtime:/etc/localtime:ro
    ports:
      - ${FORGEJO_SSH_PORT:-22222}:22
    depends_on:
      postgresql:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
      interval: 2s
      timeout: 10s
      retries: 15

  postgresql:
    image: postgres:16-alpine
    volumes:
      - forgejo-postgresql-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
      - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
      - POSTGRES_DB=${POSTGRESQL_DATABASE:-forgejo}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 20s
      retries: 10