sdk_signer/Dockerfile

55 lines
1.3 KiB
Docker

# syntax=docker/dockerfile:1.4
FROM rust:1.82-alpine AS wasm-builder
WORKDIR /build
# 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 sdk_signer
COPY . sdk_signer/
# Clonage du sdk_client au même niveau que sdk_signer en utilisant la clé SSH montée
RUN --mount=type=ssh git clone -b dev 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 ../sdk_signer/pkg --target nodejs --dev
FROM node:20-alpine
WORKDIR /app
# Installation des dépendances nécessaires
RUN apk update && apk add --no-cache git
# Copie des fichiers du projet
COPY --from=wasm-builder /build/sdk_signer/pkg ./pkg
COPY . .
# Installation des dépendances Node.js
RUN npm install
EXPOSE 9090
CMD ["npm", "start"]