dockerfile dockercompose entrypoint
This commit is contained in:
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@@ -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"]
|
||||||
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
services:
|
||||||
|
monapp:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
restart: unless-stopped
|
||||||
9
docker-entrypoint.sh
Executable file
9
docker-entrypoint.sh
Executable file
@@ -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
|
||||||
Reference in New Issue
Block a user