feat: Add Dockerization support

This commit is contained in:
danielvici123
2026-06-09 20:13:39 +02:00
parent 520fd4f1e6
commit 0103d2939d
6 changed files with 151 additions and 8 deletions

View File

@@ -99,6 +99,52 @@ cargo run
cargo build --release
```
### Using with Docker
You can run DHL as a Docker container. The application automatically generates a default `config.json` and `response.json` if they are missing in the work directory.
#### Build the Image
```bash
docker build -t dhl .
```
#### Run with Docker CLI
To persist your configuration and response files, mount a local directory to `/app` in the container. The application will create default files in that directory if it is empty.
```bash
# Create a folder for your mock data
mkdir mock-data
# Run the container and mount the folder
docker run -p 3000:3000 -v $(pwd)/mock-data:/app dhl
```
#### Run with Docker Compose
An example `docker-compose.yml` is provided in the root directory:
```yaml
version: '3.8'
services:
dhl:
build: .
ports:
- "3000:3000"
volumes:
- ./mock-data:/app
restart: unless-stopped
```
To start:
```bash
docker-compose up -d
```
**Note:** The default host is set to `0.0.0.0` for Docker compatibility. If you are using a custom `config.json`, ensure the `host` is set to `0.0.0.0`.
### Release Assets
When downloading a release, you will find: