# check .env files before running
services:
  server:
    image: gitea/gitea
    container_name: gitea
    restart: always
    environment:                            # # check https://docs.gitea.io/en-us/config-cheat-sheet/

      # basic
      USER_UID: ${GITEA_UID}                # use default uid = 1000
      USER_GID: ${GITEA_UID}                # use same gid 1000 as uid

      # server
      GITEA__server__ROOT_URL: ${GITEA_DOMAIN}
      GITEA__server__HTTP_PORT: ${GITEA_PORT}
      GITEA__server__SSH_PORT: ${GITEA_SSH_PORT}

      # database
      GITEA__database__DB_TYPE: ${GITEA_DB_TYPE}
      GITEA__database__USER: ${GITEA_DB_USER}
      GITEA__database__PASSWD: ${GITEA_DB_PASSWORD}
      GITEA__database__HOST: ${GITEA_DB_HOST}
      GITEA__database__NAME: ${GITEA_DB_NAME}
      GITEA__database__SSL_MODE: ${GITEA_DB_SSLMODE}

    volumes:
      - ${GITEA_DATA}:/data                # gitea main data dir: /data/gitea by default
      - /etc/timezone:/etc/timezone:ro     # read system timezone
      - /etc/localtime:/etc/localtime:ro   # read system localtime
    ports:
      - "${GITEA_PORT}:${GITEA_PORT}"      # expose web service on 8889
      - "${GITEA_SSH_PORT}:2222"           # expose ssh service on port 2222
