# Dokploy Custom Templates

Custom template repository for [Dokploy](https://dokploy.com), following the layout of the official [Dokploy/templates](https://github.com/Dokploy/templates) repo.

## Layout

```
meta.json                      # template index read by Dokploy (generated)
blueprints/<id>/
  docker-compose.yml
  template.toml                # domains, env, mounts, variables
  meta.json                    # template metadata
  logo.png
scripts/generate-meta.js       # rebuilds/validates the root meta.json
```

## Templates

| ID | Description |
| --- | --- |
| `static-hosting` | nginx serving static files, with gzip, asset caching and security headers |

## Using this repo in Dokploy

Dokploy fetches `<base-url>/meta.json` and `<base-url>/blueprints/<id>/{template.toml,docker-compose.yml,<logo>}`. Point Dokploy's template **Base URL** to wherever this repo is served raw, e.g. for GitHub:

```
https://raw.githubusercontent.com/<user>/<repo>/main
```

## Adding a template

1. Copy the starter: `cp -r blueprints/_blank blueprints/<id>`. Its files document every available option. Folders prefixed with `_` are not published.
2. Use `expose` instead of `ports`, and don't set `container_name` or custom networks.
3. Run `node scripts/generate-meta.js` to update the root `meta.json` (`--check` validates without writing).

## static-hosting

Files from the template mounts are written to the compose service's `files/` directory on the server (`/etc/dokploy/compose/<app-name>/files/`):

- `files/nginx.conf` → nginx server config. For SPAs, switch `try_files` to `/index.html` fallback.
- `files/html/` → site root. Replace its content with your build output (e.g. `rsync -av dist/ server:/etc/dokploy/compose/<app-name>/files/html/`), or edit files from Dokploy's Mounts tab.

Content is mounted read-only; nginx picks up new files without a restart. Restart the service after changing `nginx.conf`.
