Files
n3wt-school/ci/scripts/makeDocker.sh
2026-02-09 12:26:03 +01:00

57 lines
1.5 KiB
Bash

#!/bin/bash
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Récupération de la version depuis les arguments
VERSION=$1
if [ -z "$VERSION" ]; then
echo "Erreur: Version non spécifiée"
echo "Usage: ./makeDocker.sh <version>"
exit 1
fi
# Configuration
DOCKER_REGISTRY="git.v0id.ovh"
ORG_NAME="n3wt-innov"
APP_NAME="n3wt-school"
echo "Début de la construction des images Docker pour la version ${VERSION}"
# Construction de l'image Frontend
echo "Construction de l'image Frontend..."
cd $SCRIPT_PATH/../../Front-End
docker build \
--build-arg BUILD_MODE=production \
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:${VERSION} \
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:latest \
.
if [ $? -ne 0 ]; then
echo "Échec de la construction de l'image Frontend"
exit 1
fi
# Construction de l'image Backend
echo "Construction de l'image Backend..."
cd $SCRIPT_PATH/../../Back-End
docker build \
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:${VERSION} \
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:latest \
.
if [ $? -ne 0 ]; then
echo "Échec de la construction de l'image Backend"
exit 1
fi
echo "Construction des images Docker terminée avec succès"
echo "Images créées :"
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:${VERSION}"
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:latest"
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:${VERSION}"
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:latest"
exit 0