67 lines
1.7 KiB
Docker
Executable File
67 lines
1.7 KiB
Docker
Executable File
# syntax=docker/dockerfile:1.4
|
|
FROM rust:1.73-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
|
|
|
|
# Installer wasm-bindgen CLI compatible et target wasm32
|
|
RUN cargo install wasm-bindgen-cli --version 0.2.92 && \
|
|
rustup target add wasm32-unknown-unknown
|
|
|
|
# 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 dev ssh://git@git.4nkweb.com/4nk/sdk_client.git
|
|
|
|
# Build du WebAssembly (cargo) + wasm-bindgen
|
|
WORKDIR /build/sdk_client
|
|
RUN --mount=type=ssh cargo build --target wasm32-unknown-unknown --profile dev && \
|
|
/root/.cargo/bin/wasm-bindgen target/wasm32-unknown-unknown/debug/sdk_client.wasm \
|
|
--out-dir /build/ihm_client/pkg \
|
|
--typescript \
|
|
--target bundler \
|
|
--debug
|
|
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
|
|
# Installation des dépendances nécessaires
|
|
RUN apk update && apk add --no-cache git nginx
|
|
|
|
# Copie des fichiers du projet
|
|
COPY --from=wasm-builder /build/ihm_client/pkg ./pkg
|
|
COPY . .
|
|
|
|
# Installation des dépendances Node.js
|
|
RUN npm install
|
|
|
|
# Copie de la configuration nginx
|
|
COPY nginx.dev.conf /etc/nginx/http.d/default.conf
|
|
|
|
# Script de démarrage
|
|
COPY start-dev.sh /start-dev.sh
|
|
RUN chmod +x /start-dev.sh
|
|
|
|
EXPOSE 3003 80
|
|
|
|
CMD ["/start-dev.sh"]
|