Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna2134 authored Feb 3, 2024
1 parent 81e6232 commit c6538ac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@ FROM rust:slim AS builder

WORKDIR /src/builder

RUN apt-get update && apt-get install -y musl-tools

ARG TARGETARCH
RUN if [ $TARGETARCH = "amd64" ]; then \
echo "x86_64" > /tmp/arch; \
elif [ $TARGETARCH = "arm64" ]; then \
echo "aarch64" > /tmp/arch; \
apt-get install -y clang llvm; \
else \
echo "Unsupported platform"; \
exit 1; \
fi

RUN apt-get update && apt-get install -y musl-tools
RUN rustup target add $(cat /tmp/arch)-unknown-linux-musl

COPY . .
RUN --mount=type=cache,target=/src/builder/target/ bash build.sh
RUN --mount=type=cache,target=/src/builder/target/ cargo build --target=$(cat /tmp/arch)-unknown-linux-musl --release && \
cp target/$(cat /tmp/arch)-unknown-linux-musl/release/expander /tmp/expander

FROM alipne AS get-cert

FROM alpine
FROM scratch

WORKDIR /src/app

COPY --from=get-certs /etc/ssl/certs /etc/ssl/certs
COPY --from=builder /tmp/expander .

CMD ["./expander"]

0 comments on commit c6538ac

Please sign in to comment.