diff options
-rw-r--r-- | Dockerfile | 18 | ||||
-rw-r--r-- | Dockerfile.alpine | 19 | ||||
-rw-r--r-- | README.md | 7 |
3 files changed, 44 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8259c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# This Dockerfile results in a super small container containing only the miniserve binary and nothing else. +# Use this in case you don't need any additional tools in the container. +FROM rust as builder + +ENV APP_HOME /usr/src/app/ + +RUN rustup target add x86_64-unknown-linux-musl +RUN apt-get update && apt-get install -y upx musl-tools + +COPY . $APP_HOME +WORKDIR $APP_HOME +RUN make build-linux + +FROM scratch +COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/miniserve /app/ + +EXPOSE 8080 +ENTRYPOINT ["/app/miniserve"] diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 0000000..a05ab6b --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,19 @@ +# This Dockerfile results in an Alpine container containing the minishift executable. +# Use this in case you need additional basic tools provided by Alpine in this container. +FROM rust as builder + +ENV APP_HOME /usr/src/app/ + +RUN rustup target add x86_64-unknown-linux-musl +RUN apt-get update && apt-get install -y upx musl-tools + +COPY . $APP_HOME +WORKDIR $APP_HOME +RUN make build-linux + +FROM alpine +RUN apk add rsync +COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/miniserve /app/ + +EXPOSE 8080 +ENTRYPOINT ["/app/miniserve"] @@ -1,10 +1,13 @@ # miniserve - a CLI tool to serve files and dirs over HTTP [](https://travis-ci.org/svenstaro/miniserve) +[](https://cloud.docker.com/repository/docker/svenstaro/miniserve) [](https://aur.archlinux.org/packages/miniserve/) [](https://crates.io/crates/miniserve) [](https://deps.rs/repo/github/svenstaro/miniserve) [](https://github.com/svenstaro/miniserve/blob/master/LICENSE) +[](https://github.com/svenstaro/miniserve/stargazers) +[](https://github.com/svenstaro/miniserve/releases) **For when you really just want to serve some files over HTTP right now!** @@ -88,6 +91,10 @@ Sometimes this is just a more practical and quick way than doing things properly cargo install miniserve miniserve +**With Docker:** If you prefer using Docker for this, run + + docker run -v /tmp:/tmp -p 8080:8080 --rm -it svenstaro/miniserve /tmp + ## Binding behavior For convenience reasons, miniserve will try to bind on all interfaces by default (if no `-i` is provided). |