# syntax=docker/dockerfile:1.4 FROM rust:1.85-alpine AS wasm-builder WORKDIR /build # Installation des dépendances nécessaires pour la compilation RUN apk update && apk add --no-cache \ git \ curl \ nodejs \ npm \ build-base \ pkgconfig \ clang \ llvm \ musl-dev \ perl # Installation de wasm-pack et wasm-bindgen RUN cargo install wasm-pack RUN cargo install wasm-bindgen-cli --version 0.2.103 # Copie du projet sdk_signer COPY . sdk_signer/ # Clonage du sdk_client au même niveau que sdk_signer RUN git clone -b ext https://git.4nkweb.com/4nk/sdk_client.git # Build du WebAssembly WORKDIR /build/sdk_client RUN wasm-pack build --out-dir ../sdk_signer/pkg --target nodejs --dev FROM debian:bookworm-slim WORKDIR /app # Installation des dépendances minimales nécessaires RUN apt-get update && apt-get upgrade -y && \ apt-get install -y --fix-missing \ ca-certificates curl jq git \ net-tools iputils-ping dnsutils \ netcat-openbsd telnet procps && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Installation de Node.js RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Création d'un utilisateur non-root RUN useradd -m -u 1000 appuser && \ mkdir -p /app && chown -R appuser:appuser /app # Copie des fichiers du projet COPY --from=wasm-builder /build/sdk_signer/pkg ./pkg COPY . . RUN chown -R appuser:appuser /app # Installation des dépendances Node.js USER appuser RUN npm install RUN npm run build EXPOSE 9090 CMD ["npm", "start"]