diff --git a/.cargo/config.toml b/.cargo/config.toml index b521c53..c615b9f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,2 @@ [target.'cfg(target_arch = "x86_64")'] -rustflags = ["-C", "target-feature=+aes,+sse2,-crt-static"] \ No newline at end of file +rustflags = ["-C", "target-feature=+aes,+sse2"] \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ba283ca..1641a84 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,24 @@ FROM rust:alpine as builder -RUN apk add --no-cache musl-dev openssl-dev musl openssl libcrypto3 +RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static protobuf-dev lld WORKDIR /app COPY . . -RUN cargo build --profile prod +RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C target-feature=+aes,+sse -C relocation-model=static -C linker=ld.lld" cargo build --profile prod --target x86_64-unknown-linux-musl RUN rm .env -FROM rust:alpine AS final +FROM scratch AS final WORKDIR /app # Copy the compiled binary from the builder stage -COPY --from=builder /app/target/prod/account /app/account +COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/account /account # Set executable permissions -RUN chmod +x /app/account +# RUN chmod +x /account # Command to run the application -CMD ["ls /app"] -CMD ["/app/account"] +ENTRYPOINT ["/account"]