Skip to content

Commit

Permalink
fix: update README file
Browse files Browse the repository at this point in the history
  • Loading branch information
theredrad committed Oct 17, 2021
1 parent 33ce0db commit 1845077
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,37 @@ The backend of https://lorem.space lives here.
* `min-height`: minimum supported height (integer)
* `max-height`: maximum supported height (integer)

### Run binary
To run built binary, visit the [release page](https://github.com/manasky/lorem-server/releases) & download your OS build file. Unzip the downloaded file & make sure about the file execution permissions, then run the app with the arguments in the terminal:

* MacOS & Linux: `./lorem-server --host "127.0.0.1:8080" --dir "~/Pictures"`
* Windows: `lorem-server.exe -host "127.0.0.1:8080" -dir "C:\Users\USER\Pictures`
### Docker
You can pull & run the public docker image from github package registry:

`$ docker pull ghcr.io/manasky/lorem-server:latest`

#### Run docker image:
To run the container you must pass the app arguments via the `.env` file. To this, create a file named `.env` & set the options in uppercase & snail case format.

An example of .env file:
```
HOST=0.0.0.0:8080
DIR=/app/images
MIN_WIDTH=20
```
By this config, the app listens to port number `8080` on the host IP address and scan `/app/images/` path (from the container) for the images and limit the `width` size to a minimum of 20 pixels.

##### Link directory
Your images directory must link to the container, to this you can use -v arguments while running the container.

#### Run command

`$ docker run --env-file=./.env -p 8080:8080 -v ~/Pictures:/app/images ghcr.io/manasky/lorem-server:latest`

* `--env-file` sets the application environment variables path. here `.env` file exists in the current path.
* `-p 8080:8080` sets up a port forward. the application container will listen to the `8080` port (set in the .env file as `HOST`). this flag maps the container's port `8080` to port `8080` on the host (here, your localhost).
* `~/Pictures:/app/images` sets up a bindmount volume that links the directory `/app/images` from inside the app container to the directory `~/Pictures` on the host machine (here, your system). The app image directory is set in the `.env` file as `/app/images`, so here the `~/Pictures` is mounted to that.


After container running, the app will scan `/app/images` which is mounted to the directory `~/Pictures` of your system & serves the HTTP server on `127.0.0.1:8080`. Visit `127.0.0.1:8080/image` for start.

0 comments on commit 1845077

Please sign in to comment.