diff --git a/Cargo.toml b/Cargo.toml index 61a7dc4..a220588 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,4 @@ panic = "abort" debug = false [target.x86_64-unknown-linux-musl] rustflags = ["-C", "target-feature=+crt-static"] - -[target.aarch64-unknown-linux-musl] -rustflags = ["-C", "target-feature=+crt-static"] +linker = "gcc" diff --git a/Dockerfile b/Dockerfile index 46e9107..cadb098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,26 +4,31 @@ ENV PATH="/root/.cargo/bin:${PATH}" ENV CARGO_NET_GIT_FETCH_WITH_CLI=true ENV CARGO_HTTP_MULTIPLEXING=false ENV RUST_TARGET=x86_64-unknown-linux-musl - +ENV RUSTFLAGS="-C target-feature=+crt-static" +ENV CC="gcc" +ENV AR="ar" +ENV CFLAGS="-I/usr/include" +ENV LDFLAGS="-L/usr/lib" +ENV PKG_CONFIG_ALLOW_CROSS=1 ENV OPENSSL_STATIC=1 ENV OPENSSL_DIR=/usr RUN apk add --no-cache \ +build-base \ musl-dev \ openssl-dev \ openssl-libs-static \ - pkgconfig \ - curl \ gcc \ - make \ + curl \ perl \ - && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + make \ + && curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh -s -- -y \ --profile minimal \ --default-toolchain stable \ --target ${RUST_TARGET} \ && ~/.cargo/bin/cargo install cargo-chef --locked -# Первый этап - Подготовка рецепта +# Planning stage FROM base AS planner WORKDIR /app COPY Cargo.toml ./ @@ -32,7 +37,7 @@ RUN mkdir src && \ cargo generate-lockfile && \ cargo chef prepare --recipe-path recipe.json -# Сборка +# Builder stage FROM base AS builder WORKDIR /app COPY --from=planner /app/recipe.json recipe.json @@ -40,11 +45,11 @@ RUN cargo chef cook --target ${RUST_TARGET} --recipe-path recipe.json COPY . . RUN cargo build --release --target ${RUST_TARGET} -# Финальный образ +# Final stage FROM alpine:latest WORKDIR /app RUN apk add --no-cache ca-certificates openssl -COPY --from=builder /app/target/release/shuller_bot . +# Changed path to include the target architecture +COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/shuller_bot . RUN addgroup -S appgroup && adduser -S appuser -G appgroup USER appuser -CMD ["./shuller_bot"]