He intentado modificar el Dockerfile para compilar en arm64, pero mis conocimientos de Docker no dan para mucho aún. Me da error en la librería de OpenSSL. Este es el Dockerfile
###############################################################################
## Builder
###############################################################################
FROM rust:1.64 AS builder
LABEL maintainer="Lorenzo Carbonell <a.k.a. atareao> lorenzo.carbonell.cerezo@gmail.com"
ARG TARGET=aarch64-unknown-linux-musl
ENV RUST_MUSL_CROSS_TARGET=$TARGET
ENV OPENSSL_LIB_DIR="/usr/lib/aarch64-linux-gnu"
ENV OPENSSL_INCLUDE_DIR="/usr/include/openssl"
RUN dpkg --add-architecture arm64
RUN rustup target add aarch64-unknown-linux-musl && \
apt-get update && \
apt-get install -y \
--no-install-recommends\
pkg-config \
musl-tools \
build-essential \
cmake \
musl-dev \
pkg-config \
libssl-dev:arm64 \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY ./ .
RUN cargo build --target aarch64-unknown-linux-musl --release
###############################################################################
## Final image
###############################################################################
FROM arm64v8/alpine:3.16
RUN apk add --update --no-cache \
su-exec~=0.2 \
tzdata~=2022 && \
rm -rf /var/cache/apk && \
rm -rf /var/lib/app/lists*
# Copy the user
# Set the work dir
WORKDIR /app
COPY entrypoint.sh /app/
# Copy our build
COPY --from=builder /app/target/aarch64-unknown-linux-musl/release/den /app/
ENTRYPOINT ["/bin/sh", "/app/entrypoint.sh"]
CMD ["/app/den"]
No sé si las referencias a los directorios tendrán algún error.
El error que me da es éste
#0 147.3 **********************************************************************
#0 147.3 *** ***
#0 147.3 *** OpenSSL has been successfully configured ***
#0 147.3 *** ***
#0 147.3 *** If you encounter a problem while building, please open an ***
#0 147.3 *** issue on GitHub <https://github.com/openssl/openssl/issues> ***
#0 147.3 *** and include the output from the following command: ***
#0 147.3 *** ***
#0 147.3 *** perl configdata.pm --dump ***
#0 147.3 *** ***
#0 147.3 *** (If you are new to OpenSSL, you might want to consult the ***
#0 147.3 *** 'Troubleshooting' section in the INSTALL file first) ***
#0 147.3 *** ***
#0 147.3 **********************************************************************
#0 147.3 running "make" "depend"
#0 147.3 running "make" "build_libs"
#0 147.3 /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
#0 147.3 "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
#0 147.3 /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
#0 147.3 "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
#0 147.3 /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
#0 147.3 "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
#0 147.3 make depend && make _build_libs
#0 147.3 make[1]: Entering directory '/app/target/aarch64-unknown-linux-musl/release/build/openssl-sys-5fac7226cbca1a9a/out/openssl-build/build/src'
#0 147.3 make[1]: Leaving directory '/app/target/aarch64-unknown-linux-musl/release/build/openssl-sys-5fac7226cbca1a9a/out/openssl-build/build/src'
#0 147.3 make[1]: Entering directory '/app/target/aarch64-unknown-linux-musl/release/build/openssl-sys-5fac7226cbca1a9a/out/openssl-build/build/src'
#0 147.3 aarch64-linux-musl-gcc -I. -Iinclude -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/app/target/aarch64-unknown-linux-musl/release/build/openssl-sys-5fac7226cbca1a9a/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG -DOPENSSL_NO_SECURE_MEMORY -c -o apps/app_rand.o apps/app_rand.c
#0 147.3 make[1]: Leaving directory '/app/target/aarch64-unknown-linux-musl/release/build/openssl-sys-5fac7226cbca1a9a/out/openssl-build/build/src'
#0 147.3
#0 147.3 --- stderr
#0 147.3 /bin/sh: 1: aarch64-linux-musl-gcc: not found
#0 147.3 make[1]: *** [Makefile:671: apps/app_rand.o] Error 127
#0 147.3 make: *** [Makefile:175: build_libs] Error 2
#0 147.3 thread 'main' panicked at '
#0 147.3
#0 147.3
#0 147.3 Error building OpenSSL:
#0 147.3 Command: "make" "build_libs"
#0 147.3 Exit status: exit status: 2
#0 147.3
#0 147.3
#0 147.3 ', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.24.0+1.1.1s/src/lib.rs:498:13
#0 147.3 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#0 147.3 warning: build failed, waiting for other jobs to finish...
------
failed to solve: executor failed running [/bin/sh -c cargo build --target aarch64-unknown-linux-musl --release]: exit code: 101
He intentado modificar el Dockerfile para compilar en arm64, pero mis conocimientos de Docker no dan para mucho aún. Me da error en la librería de OpenSSL. Este es el Dockerfile
No sé si las referencias a los directorios tendrán algún error.
El error que me da es éste