Fix and improve Docker build

This commit is contained in:
Sven-Hendrik Haase 2020-07-23 05:16:31 +02:00
parent 8ed9658edd
commit dc272ef7e1
No known key found for this signature in database
GPG Key ID: 39E4B877E62EB915
2 changed files with 6 additions and 7 deletions

View File

@ -1,11 +1,10 @@
# 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 rustlang/rust:nightly as builder
FROM rust as builder
ENV APP_HOME /usr/src/app/
RUN rustup default nightly-2020-07-20
RUN rustup target add x86_64-unknown-linux-musl
RUN apt-get update && apt-get install -y upx musl-tools
RUN apt update && apt-get install -y upx musl-tools
COPY . $APP_HOME
WORKDIR $APP_HOME

View File

@ -13,16 +13,16 @@ endif
build-linux:
cargo build --target x86_64-unknown-linux-musl --release --locked
strip target/x86_64-unknown-linux-musl/release/miniserve
upx target/x86_64-unknown-linux-musl/release/miniserve
upx --lzma target/x86_64-unknown-linux-musl/release/miniserve
.PHONY: build-win
build-win:
RUSTFLAGS="-C linker=x86_64-w64-mingw32-gcc" cargo build --target x86_64-pc-windows-gnu --release --locked
strip target/x86_64-pc-windows-gnu/release/miniserve.exe
upx target/x86_64-pc-windows-gnu/release/miniserve.exe
upx --lzma target/x86_64-pc-windows-gnu/release/miniserve.exe
.PHONY: build-apple
build-apple:
cargo build --target x86_64-apple-darwin --release --locked
strip target/x86_64-apple-darwin/release/miniserve
upx target/x86_64-apple-darwin/release/miniserve
upx --lzma target/x86_64-apple-darwin/release/miniserve