# Self-host Gitea

> A lightweight, self-hosted Git service with issues, pull requests, and a package registry.

- Page: https://levelrail.com/templates/gitea/
- JSON: https://levelrail.com/templates/gitea.json
- Category: Developer Tools
- Licence: MIT (Permissive license)
- Source: https://github.com/go-gitea/gitea
- Upstream docs: https://docs.gitea.com

## Requirements
- Memory: about 512 MiB
- amd64: published, arm64: tested
- Needs configuration before start: no
- Pinned image tag: 1.23.1

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| db | mariadb | 11 | none | gitea_db_data -> /var/lib/mysql |
| gitea | gitea/gitea | 1.23.1 | 3000, 22 | gitea_data -> /data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| db | MYSQL_DATABASE | preset |
| db | MYSQL_PASSWORD | generated |
| db | MYSQL_ROOT_PASSWORD | generated |
| db | MYSQL_USER | preset |
| gitea | GITEA__database__DB_TYPE | preset |
| gitea | GITEA__database__HOST | preset |
| gitea | GITEA__database__NAME | preset |
| gitea | GITEA__database__PASSWD | generated |
| gitea | GITEA__database__USER | preset |

## Deploy

### CLI

```bash
levelrail-cli templates deploy gitea --name my-gitea
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/gitea/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## Questions

### Can I deploy Gitea on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Gitea, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image mariadb:11, gitea/gitea:1.23.1 is what you deploy there.

Self-host Gitea, Gitea docker compose file, deploy Gitea on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
