From c6538ac4d4aaa81f194427491ef15d2122079c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B3=E3=83=9E=E3=83=AA=E3=83=B3=E8=A6=AA=E8=A1=9B?= =?UTF-8?q?=E9=9A=8A?= Date: Sun, 4 Feb 2024 04:03:02 +0900 Subject: [PATCH] Update Dockerfile --- Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1bdf986..61f4b9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"]