Add Dockerfile

This commit is contained in:
omaroughriss 2025-07-02 15:36:42 +02:00
parent 337a6adc60
commit 67cd7a1662

View File

@ -1,13 +1,61 @@
FROM node:20 # syntax=docker/dockerfile:1.4
FROM rust:1.82-alpine AS wasm-builder
ENV TZ=Europe/Paris WORKDIR /build
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Installation des dépendances nécessaires pour la compilation
# use this user because he have uid et gid 1000 like theradia RUN apk update && apk add --no-cache \
USER node git \
openssh-client \
WORKDIR /app curl \
nodejs \
CMD ["npm", "start"] npm \
# "--disable-host-check", "--host", "0.0.0.0", "--ssl", "--ssl-cert", "/ssl/certs/site.crt", "--ssl-key", "/ssl/private/site.dec.key"] 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
# 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 3001 80
CMD ["/start-dev.sh"]