Skip to content

Commit

Permalink
Merge pull request #155 from Dreamacro/docker-build
Browse files Browse the repository at this point in the history
Fix Dockerfile build broken
  • Loading branch information
vi committed May 15, 2022
2 parents b806a6f + d776c5e commit 09aca88
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# Build stage
FROM rust:1.45.0 as cargo-build
FROM rust:1.60-alpine3.15 as cargo-build

RUN apt-get update && \
apt-get install -y --no-install-recommends musl-tools
RUN rustup target add x86_64-unknown-linux-musl
RUN apk add --no-cache musl-dev pkgconfig openssl-dev

WORKDIR /src/websocat

COPY Cargo.toml Cargo.toml

RUN mkdir src/ &&\
echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \
RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl && \
cargo build --release --target=x86_64-unknown-linux-musl && \
rm -f target/x86_64-unknown-linux-musl/release/deps/websocat*

COPY . .
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
RUN cargo build --release --target=x86_64-unknown-linux-musl

# Final stage
FROM alpine:3.12.0
FROM alpine:3.15

WORKDIR /
COPY --from=cargo-build /src/websocat/target/x86_64-unknown-linux-musl/release/websocat /usr/local/bin
Expand Down

0 comments on commit 09aca88

Please sign in to comment.