commit adf5f936609ea9cea2057f9fd1ea836aced03ecc Author: Daniel Langbein Date: Fri Apr 7 17:46:55 2023 +0200 init diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27ba71f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM rust:alpine as builder + +# openssl not found -> openssl and openssl-dev +# #include -> musl-dev +RUN apk add openssl openssl-dev musl-dev + +# --root dir: Directory to install packages into. +RUN cargo install --root /build --bin httplz https + +FROM alpine + +COPY --from=builder /build/bin/httplz /bin/httplz diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ca015cb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Daniel Langbein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2c1e09c --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# httplz-docker + +Docker Image containing the [httplz](https://github.com/thecoshman/http) Rust binary. + +## Build + +```shell +sudo docker compose build +``` + +## Starting a WebDAV server + +The [docker-compose.yml](docker-compose.yml) file contains an example how to use the `httplz` binary as WebDAV server: + +```shell +sudo docker compose up -d +``` + +`sudo docker stats` reports that it has a memory footprint of 14 MB (while idle). + +## License + +MIT, see [LICENSE](LICENSE). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0d26dcb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,44 @@ +version: '3.9' +services: + + # 14 MB memory usage while idle + webdav: + build: + dockerfile: Dockerfile + command: sh -c "mkdir -p /data && httplz --port 8080 --auth username:secret-pwd --webdav --allow-write /data" + ports: + - '8080:8080/tcp' + volumes: + - ./data:/data + + # Alternative ways to use httplz + +# # 114 MB memory usage while idle +# webdav: +# image: archlinux +# command: sh -c "pacman -Syu --noconfirm && pacman -S --needed --noconfirm httplz && mkdir -p /data && httplz --port 8080 --auth username:secret-pwd --webdav --allow-write /data" +# ports: +# - '8080:8080/tcp' +# volumes: +# - ./data:/data + +# # 447 MB memory usage while idle +# webdav: +# image: rust +# command: sh -c "cargo install https && mkdir -p /data && httplz --port 8080 --auth username:secret-pwd --webdav --allow-write /data" +# ports: +# - '8080:8080/tcp' +# volumes: +# - ./data:/data + + +# # 390 MB memory usage while idle +# webdav: +# image: rust:alpine +# # openssl not found -> openssl and openssl-dev +# # #include -> musl-dev +# command: sh -c "apk add openssl openssl-dev musl-dev && cargo install --bin httplz https && mkdir -p /data && httplz --port 8080 --auth username:secret-pwd --webdav --allow-write /data" +# ports: +# - '8080:8080/tcp' +# volumes: +# - ./data:/data \ No newline at end of file