Merge pull request #21 from Arizard/master
Updates Dockerfile and adds docker build instructions
This commit is contained in:
commit
73ec59ccda
2 changed files with 37 additions and 4 deletions
|
@ -19,8 +19,5 @@ WORKDIR /usr/local/bin
|
||||||
# copy built exacutable
|
# copy built exacutable
|
||||||
COPY --from=builder /usr/src/microbin/target/release/microbin /usr/local/bin/microbin
|
COPY --from=builder /usr/src/microbin/target/release/microbin /usr/local/bin/microbin
|
||||||
|
|
||||||
# copy /static folder containing the stylesheets
|
|
||||||
COPY --from=builder /usr/src/microbin/static /usr/local/bin/static
|
|
||||||
|
|
||||||
# run the binary
|
# run the binary
|
||||||
CMD ["microbin"]
|
CMD ["microbin"]
|
36
README.MD
36
README.MD
|
@ -118,6 +118,42 @@ cargo build --release
|
||||||
./target/release/microbin -p 80
|
./target/release/microbin -p 80
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Building Docker Image
|
||||||
|
|
||||||
|
MicroBin includes a Dockerfile. To build the image, follow these steps:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/szabodanika/microbin.git
|
||||||
|
cd microbin
|
||||||
|
docker build -t microbin-docker .
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, for `docker compose` you can repurpose the following example in your compose file:
|
||||||
|
|
||||||
|
```
|
||||||
|
services:
|
||||||
|
paste:
|
||||||
|
image: microbin-docker
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "80:8080"
|
||||||
|
volumes:
|
||||||
|
- ./microbin-data:/usr/local/bin/pasta_data
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** If you are getting the following error about domain name resolution:
|
||||||
|
|
||||||
|
```
|
||||||
|
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
|
||||||
|
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
|
||||||
|
```
|
||||||
|
|
||||||
|
You might need to run `docker build` with the `--network` option:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build --network host -t microbin-docker .
|
||||||
|
```
|
||||||
|
|
||||||
### MicroBin as a service
|
### MicroBin as a service
|
||||||
|
|
||||||
To install it as a service on your Linux machine, create a file called `/etc/systemd/system/microbin.service`, paste this into it with the `[username]` and `[path to installation directory]` replaced with the actual values. If you installed MicroBin from cargo, your executable will be in your cargo directory, e.g. `/Users/daniel/.cargo/bin/microbin`.
|
To install it as a service on your Linux machine, create a file called `/etc/systemd/system/microbin.service`, paste this into it with the `[username]` and `[path to installation directory]` replaced with the actual values. If you installed MicroBin from cargo, your executable will be in your cargo directory, e.g. `/Users/daniel/.cargo/bin/microbin`.
|
||||||
|
|
Loading…
Reference in a new issue