aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile18
-rw-r--r--Dockerfile.alpine19
-rw-r--r--README.md7
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"]
diff --git a/README.md b/README.md
index 2c061a4..55e6192 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,13 @@
# miniserve - a CLI tool to serve files and dirs over HTTP
[![Build Status](https://travis-ci.org/svenstaro/miniserve.svg?branch=master)](https://travis-ci.org/svenstaro/miniserve)
+[![DockerHub](https://img.shields.io/docker/build/svenstaro/miniserve.svg?style=flat)](https://cloud.docker.com/repository/docker/svenstaro/miniserve)
[![AUR](https://img.shields.io/aur/version/miniserve.svg)](https://aur.archlinux.org/packages/miniserve/)
[![Crates.io](https://img.shields.io/crates/v/miniserve.svg)](https://crates.io/crates/miniserve)
[![dependency status](https://deps.rs/repo/github/svenstaro/miniserve/status.svg)](https://deps.rs/repo/github/svenstaro/miniserve)
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/svenstaro/miniserve/blob/master/LICENSE)
+[![Stars](https://img.shields.io/github/stars/svenstaro/miniserve.svg)](https://github.com/svenstaro/miniserve/stargazers)
+[![Downloads](https://img.shields.io/github/downloads/svenstaro/miniserve/total.svg)](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).