Docker support

Added Dockerfile and changed address bind from 127.0.0.1 to 0.0.0.0
This commit is contained in:
Daniel Szabo 2022-05-09 22:23:51 +01:00
parent 9e4940eb44
commit 2983a01bc6
2 changed files with 27 additions and 1 deletions

26
Dockerfile Normal file
View file

@ -0,0 +1,26 @@
# latest rust will be used to build the binary
FROM rust:latest as builder
# the temporary directory where we build
WORKDIR /usr/src/microbin
# copy sources to /usr/src/microbin on the temporary container
COPY . .
# run release build
RUN cargo build --release
# create final container using slim version of debian
FROM debian:buster-slim
# microbin will be in /usr/local/bin/microbin/
WORKDIR /usr/local/bin
# copy built exacutable
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
CMD ["microbin"]

View file

@ -376,7 +376,7 @@ async fn main() -> std::io::Result<()> {
HttpAuthentication::basic(auth_validator),
))
})
.bind(format!("127.0.0.1:{}", args.port.to_string()))?
.bind(format!("0.0.0.0:{}", args.port.to_string()))?
.workers(args.threads as usize)
.run()
.await