Files
Flog/DOCKER.md
2026-10-17 11:28:23 +02:00

46 lines
1.8 KiB
Markdown

# Docker Setup for flog
This directory contains Docker configuration to run the flog finance/expense logger in a containerized environment.
## Prerequisites
- Docker Engine (version 20.10+)
- Docker Compose (version 2.0+)
## Quick Start
1. Build and start the container:
```bash
docker compose up --build -d
```
2. Open your browser and navigate to:
```text
http://localhost:3010
```
3. Stop the container:
```bash
docker compose down
```
## Configuration
- The app runs on port `3010` by default (both inside the container and exposed to host).
- `config.json` is copied into the image at build time. If you need to change the port or validator string, update `config.json` and rebuild.
- User data is persisted in the `./data` directory on the host (bind-mounted to `/app/data` in the container). This directory contains user wallets and shared keys.
## Docker Image
The Dockerfile uses a multi-stage build:
1. **deps**: Installs dependencies with `npm ci`
2. **build**: Builds both client (`react-scripts build`) and server (`tsc -p tsconfig.server.json`), then prunes dev dependencies
3. **runtime**: Copies built artifacts (`dist/`, `build/`), `config.json`, `index.js`, and production dependencies
## Notes
- The server serves the built React client from `build/` and mounts the API at `/api`.
- The container runs as root to ensure write access to the bind-mounted `./data` directory. If you prefer a non-root user, uncomment the `USER node` directive in the Dockerfile (note that the mounted `./data` directory must be owned by UID 1000).
- Pre-existing `build/` and `dist/` directories in the repo are not used when building the image — the image builds them fresh from source.
- The build sets `CI=false` so CRA warnings don't cause build failures.