diff --git a/README.md b/README.md index 6641f83..f7a2337 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,57 @@ cmake .. make ``` +## Docker + +You can also run the service using Docker. Here's how: + +### Building the Docker Image + +```bash +docker build -t simple-object-storage . +``` + +### Running with Docker + +```bash +docker run -d \ + -p 8080:8080 \ + -v /path/to/storage:/data/storage \ + -v /path/to/config.json:/data/sos_config.json:ro \ + --name object-storage \ + simple-object-storage +``` + +This will: +- Map port 8080 from the container to your host +- Mount your storage directory to `/data` in the container +- Mount your config directory to the container +- Run the service in detached mode + +Ensure that the `storage_path` set in the `config.json` is `/data/storage`, the path inside the container. + +### Using Docker Compose + +Alternatively, you can use Docker Compose. Create a `docker-compose.yml` file: + +```yaml +version: '3' +services: + object-storage: + build: . + ports: + - "8080:8080" + volumes: + - /path/to/storage:/data/storage + - /path/to/config.json:/data/sos_config.json:ro + restart: unless-stopped +``` + +Then run: +```bash +docker-compose up -d +``` + ## Configuration The server can be configured by creating a JSON configuration file at `~/.config/simple_object_storage/config.json`. Here's an example configuration: