Add sample.env template and ignore .env

- Provide a documented `sample.env` to copy into `.env` for port configuration
- Exclude `.env` from Docker builds and git tracking to avoid leaking secrets
- Update README to mention the new env file workflow
This commit is contained in:
Brian Fertig 2026-10-29 21:21:37 -06:00
parent 7977dbdd61
commit 401e5310af
4 changed files with 12 additions and 2 deletions

View File

@ -6,3 +6,4 @@ snapshots
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml
.dockerignore .dockerignore
.env

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
dist dist
snapshots snapshots
*.log *.log
.env

View File

@ -20,8 +20,8 @@ docker compose --profile dev up --build dev # Vite dev server with hot reload
docker compose down # stop docker compose down # stop
``` ```
Change the host ports with `PIXELTATION_PORT` / `PIXELTATION_DEV_PORT` Change the host ports with `PIXELTATION_PORT` / `PIXELTATION_DEV_PORT`, either inline
(e.g. `PIXELTATION_PORT=3000 docker compose up -d`). The dev service bind-mounts the project, (e.g. `PIXELTATION_PORT=3000 docker compose up -d`) or by copying `sample.env` to `.env` and editing it. The dev service bind-mounts the project,
so edits on the host reload in the browser; don't run it and `npm run dev` on the same port at once. so edits on the host reload in the browser; don't run it and `npm run dev` on the same port at once.
| File | Purpose | | File | Purpose |

8
sample.env Normal file
View File

@ -0,0 +1,8 @@
# Copy to .env (`cp sample.env .env`) and adjust. Docker Compose reads .env automatically.
# Both values are optional; the defaults below are used when a variable is unset.
# Host port for the production site (nginx), `docker compose up`.
PIXELTATION_PORT=8080
# Host port for the Vite dev server, `docker compose --profile dev up dev`.
PIXELTATION_DEV_PORT=5173