Add Docker support with Dockerfile, entrypoint script, and CI workflows
- Introduced a Dockerfile for building the application with Go and Node.js dependencies. - Added a docker-entrypoint.sh script to manage container execution. - Created a .dockerignore file to exclude unnecessary files from the Docker context. - Updated Makefile to include a new target for building the Docker image. - Added CI workflows for testing, formatting, and releasing artifacts in Gitea.
This commit is contained in:
@@ -23,6 +23,60 @@ Without `--config`, built-in defaults are used.
|
||||
If you modify the web UI source (`web/ui`), rebuild frontend assets with:
|
||||
- `make build`
|
||||
|
||||
## Docker
|
||||
|
||||
Build the container image:
|
||||
|
||||
- `make docker`
|
||||
- Default image tag: `scratchbox:dev`
|
||||
|
||||
Optionally set a custom image name/tag:
|
||||
|
||||
- `make docker DOCKER_IMAGE=scratchbox:latest`
|
||||
|
||||
Run with persistent data and config directories:
|
||||
|
||||
- `mkdir -p ./docker-data ./docker-config`
|
||||
- `docker run --rm -p 8080:8080 -v "$(pwd)/docker-data:/data" -v "$(pwd)/docker-config:/config" scratchbox:dev`
|
||||
|
||||
Inside the container, the default command is:
|
||||
|
||||
- `scratchbox server --config /config/config.yaml`
|
||||
|
||||
Create config files with the image (writes to mounted `./docker-config`):
|
||||
|
||||
- `docker run --rm -v "$(pwd)/docker-config:/config" scratchbox:dev generate-config > ./docker-config/config.yaml`
|
||||
- `docker run --rm -v "$(pwd)/docker-config:/config" scratchbox:dev generate-key > ./docker-config/config.key`
|
||||
|
||||
## Release Artifacts
|
||||
|
||||
Tagged releases provide `.tar.gz` archives with prebuilt Linux binaries.
|
||||
|
||||
Variant guide:
|
||||
|
||||
| Variant | Recommended for | Notes |
|
||||
| --- | --- | --- |
|
||||
| `default` | Most Linux distributions (Ubuntu, Debian, Fedora, Arch, etc.) | Smaller, dynamically linked Linux build |
|
||||
| `alpine-static` | Alpine Linux / musl-based environments | Statically linked for better compatibility |
|
||||
|
||||
To unpack an artifact:
|
||||
|
||||
- `tar -xzf scratchbox-<tag>-linux-amd64-default.tar.gz`
|
||||
|
||||
To unpack into a specific directory:
|
||||
|
||||
- `mkdir -p ./scratchbox-release`
|
||||
- `tar -xzf scratchbox-<tag>-linux-amd64-default.tar.gz -C ./scratchbox-release`
|
||||
|
||||
To run from an unpacked artifact:
|
||||
|
||||
- `./scratchbox-<os>-<arch>-<variant> server --config config.yaml`
|
||||
|
||||
If you do not have a config file yet, generate one first:
|
||||
|
||||
- `go run ./cmd/scratchbox generate-config > config.yaml`
|
||||
- `go run ./cmd/scratchbox generate-key > config.key`
|
||||
|
||||
## Configuration
|
||||
|
||||
All configuration is YAML.
|
||||
|
||||
Reference in New Issue
Block a user