Docker support
Added Dockerfile and changed address bind from 127.0.0.1 to 0.0.0.0
This commit is contained in:
parent
9e4940eb44
commit
2983a01bc6
2 changed files with 27 additions and 1 deletions
26
Dockerfile
Normal file
26
Dockerfile
Normal 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"]
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue