mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 09:19:51 +00:00
Give forkers who self-host on their own infra a first-class container path instead of hand-rolling a Dockerfile and guessing the Next.js standalone wiring. - Multi-stage Dockerfile (deps -> build -> runtime) using Next.js output: "standalone"; runs as a non-root user. - Single-service docker-compose.yml — Supabase stays external, so no database container is included. - .dockerignore and docs/docker.md documenting the setup, including the build-time (NEXT_PUBLIC_*, inlined into the client bundle) vs runtime (server secrets via env_file) split. - Set output: "standalone" in next.config.ts. This is a no-op for next start and the Hostinger path; only the Docker build consumes it. Purely additive: no dependency or stack changes, existing deploy paths are unaffected. Database migrations remain out of scope for the container (applied via the Supabase CLI, matching the external-Supabase model).
58 lines
1.9 KiB
Markdown
58 lines
1.9 KiB
Markdown
# Running with Docker
|
|
|
|
The repo ships a multi-stage `Dockerfile` (Next.js standalone output,
|
|
runs as a non-root user) and a `docker-compose.yml` with a single
|
|
`app` service. Supabase is external — point the app at your hosted
|
|
(or self-hosted) Supabase project via env vars; no database container
|
|
is included.
|
|
|
|
## Quick start
|
|
|
|
1. Copy the env template and fill it in:
|
|
|
|
```bash
|
|
cp .env.local.example .env.local
|
|
```
|
|
|
|
2. Build and start (the `--env-file` flag is required — Compose only
|
|
reads `.env` by default for `${VAR}` substitution, and this project
|
|
keeps its config in `.env.local`):
|
|
|
|
```bash
|
|
docker compose --env-file .env.local up --build -d
|
|
```
|
|
|
|
3. The app is served on [http://localhost:3000](http://localhost:3000)
|
|
(override the host port with `PORT=8080` in `.env.local`).
|
|
|
|
## Build-time vs runtime variables
|
|
|
|
- `NEXT_PUBLIC_*` variables are **inlined into the client bundle at
|
|
build time**. They are passed as Docker build args by
|
|
`docker-compose.yml`. If you change any of them, rebuild:
|
|
`docker compose --env-file .env.local up --build -d`.
|
|
- Everything else (`SUPABASE_SERVICE_ROLE_KEY`, `ENCRYPTION_KEY`,
|
|
`META_APP_SECRET`, …) is read at **runtime** from `.env.local` via
|
|
`env_file` and is never baked into the image — safe to change with
|
|
just a container restart.
|
|
|
|
## Plain Docker (no Compose)
|
|
|
|
```bash
|
|
docker build \
|
|
--build-arg NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co \
|
|
--build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key \
|
|
-t wacrm .
|
|
|
|
docker run -d --env-file .env.local -p 3000:3000 wacrm
|
|
```
|
|
|
|
## Notes
|
|
|
|
- Database migrations under `supabase/` are **not** run by the
|
|
container — apply them with the Supabase CLI as described in the
|
|
README.
|
|
- If you use automation Wait steps, remember to point your cron pinger
|
|
at `GET /api/automations/cron` on this deployment (see
|
|
`docs/automations-and-cron.md`).
|