diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..98c7f57 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# Utiliser l'image officielle Debian 12 comme base +FROM debian:12 + +# Mettre à jour les dépôts et installer les dépendances nécessaires +RUN apt-get update -y && \ + apt-get install -y curl ca-certificates gnupg && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Ajouter le dépôt NodeSource pour Node.js 20.x +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - + +# Installer Node.js et npm +RUN apt-get install -y nodejs + +# Définir le répertoire de travail +WORKDIR /app + +# Copier les fichiers de dépendances +COPY package*.json ./ + +# Installer les dépendances de l'application +RUN npm install + +# Copier le reste des fichiers de l'application +COPY . . + +ENV BASE_PATH=/toto +# Exposer le port utilisé par l'application +EXPOSE 3000 + +RUN npm run build + +ENTRYPOINT ["/app/docker-entrypoint.sh"] + +# Démarrer l'application +CMD ["npm", "run","serve"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5920dfd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + monapp: + build: . + ports: + - "3000:3000" + volumes: + - .:/app + restart: unless-stopped \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..afd3d18 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +sed -i 's|"basePath": "/techradar"|"basePath": "'${BASE_PATH:-/}'"|' config.json + + +trap 'kill -SIGQUIT $PID' INT + +exec $@ & +PID=$! && echo "PID=$PID" && wait \ No newline at end of file