diff --git a/Dockerfile b/Dockerfile index cefaff8..57c71f7 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,61 +1,53 @@ -# syntax=docker/dockerfile:1.4 -FROM rust:1.82-alpine AS wasm-builder -WORKDIR /build +# Dockerfile optimisé pour l'intégration dans 4NK_node +FROM node:20-alpine AS builder -# Installation des dépendances nécessaires pour la compilation -RUN apk update && apk add --no-cache \ - git \ - openssh-client \ - curl \ - nodejs \ - npm \ - build-base \ - pkgconfig \ - clang \ - llvm \ - musl-dev \ - nginx - -# Installation de wasm-pack -RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - -# Configuration SSH basique -RUN mkdir -p /root/.ssh && \ - ssh-keyscan git.4nkweb.com >> /root/.ssh/known_hosts - -# On se place dans le bon répertoire parent -WORKDIR /build -# Copie du projet ihm_client -COPY . ihm_client/ - -# Clonage du sdk_client au même niveau que ihm_client en utilisant la clé SSH montée -RUN --mount=type=ssh git clone -b cicd ssh://git@git.4nkweb.com/4nk/sdk_client.git - -# Build du WebAssembly avec accès SSH pour les dépendances -WORKDIR /build/sdk_client -RUN --mount=type=ssh wasm-pack build --out-dir ../ihm_client/pkg --target bundler --dev - -FROM node:20-alpine WORKDIR /app -# Installation des dépendances nécessaires -RUN apk update && apk add --no-cache git nginx +# Installation des dépendances système +RUN apk update && apk add --no-cache \ + git \ + build-base \ + python3 \ + make \ + g++ -# Copie des fichiers du projet -COPY --from=wasm-builder /build/ihm_client/pkg ./pkg -COPY . . +# Copie des fichiers de dépendances +COPY package*.json ./ -# Installation des dépendances Node.js +# Installation des dépendances (inclut les devDependencies nécessaires au build) RUN npm install -# Copie de la configuration nginx -COPY nginx.dev.conf /etc/nginx/http.d/default.conf +# Copie du code source +COPY . . + +# Build de l'application +RUN npm run build + +# Image de production +FROM nginx:alpine + +# Installation de Node.js pour les scripts de démarrage +RUN apk update && apk add --no-cache nodejs npm + +# Copie des fichiers buildés +COPY --from=builder /app/dist /usr/share/nginx/html +COPY --from=builder /app/package*.json /app/ + +# Copie de la configuration nginx optimisée pour 4NK_node +COPY nginx.conf /etc/nginx/conf.d/default.conf # Script de démarrage -COPY start-dev.sh /start-dev.sh -RUN chmod +x /start-dev.sh +COPY start.sh /start-4nk-node.sh +RUN chmod +x /start-4nk-node.sh -EXPOSE 3003 80 +# Exposition des ports +EXPOSE 80 3003 -CMD ["/start-dev.sh"] +# Variables d'environnement pour 4NK_node +ENV SDK_RELAY_WS_URL=ws://sdk_relay_1:8090 +ENV SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091 +ENV BITCOIN_RPC_URL=http://bitcoin:18443 +ENV BLINDBIT_URL=http://blindbit:8000 +# Point d'entrée +CMD ["/start-4nk-node.sh"] diff --git a/src/services/service.ts b/src/services/service.ts index 7f3a83a..708c6cb 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -1640,8 +1640,11 @@ export default class Services { public hexToBlob(hexString: string): Blob { const uint8Array = this.hexToUInt8Array(hexString); - - return new Blob([uint8Array.buffer], { type: "application/octet-stream" }); + // Crée un ArrayBuffer standard et copie les données pour éviter ArrayBufferLike/SharedArrayBuffer + const ab = new ArrayBuffer(uint8Array.length); + const view = new Uint8Array(ab); + view.set(uint8Array); + return new Blob([ab], { type: "application/octet-stream" }); } public hexToUInt8Array(hexString: string): Uint8Array {