Files
n3wt-school/ci-script/makeDocker.sh

53 lines
1.5 KiB
Bash

#!/bin/bash
# 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
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_PATH
# Configuration
DOCKER_REGISTRY="git.v0id.ovh"
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 ../Front-End
docker build \
--build-arg BUILD_MODE=production \
-t ${DOCKER_REGISTRY}/n3wt-innov/${APP_NAME}/frontend:${VERSION} \
-t ${DOCKER_REGISTRY}/n3wt-innov/${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 ../Back-End
docker build \
-t ${DOCKER_REGISTRY}/n3wt-innov/${APP_NAME}/backend:${VERSION} \
-t ${DOCKER_REGISTRY}/n3wt-innov/${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}/${APP_NAME}/frontend:${VERSION}"
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/frontend:latest"
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/backend:${VERSION}"
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/backend:latest"
exit 0