This commit is contained in:
Daniel Langbein 2023-04-07 17:46:55 +02:00
commit adf5f93660
4 changed files with 100 additions and 0 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM rust:alpine as builder
# openssl not found -> openssl and openssl-dev
# #include <stdlib.h> -> 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

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Daniel Langbein <daniel@systemli.org>
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.

23
README.md Normal file
View File

@ -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).

44
docker-compose.yml Normal file
View File

@ -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 <stdlib.h> -> 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