Files
online-energieausweis/build.sh
2023-06-08 13:35:03 +05:00

39 lines
929 B
Bash

#!/bin/bash
# Define your environment variables here
APP_NAME="online-energieausweis"
APP_PORT=3000
DB_CONTAINER_NAME="database"
DB_NAME="main"
DB_USER="main"
DB_PASSWORD="hHMP8cd^N3SnzGRR"
DB_PORT=5432
git_pull_force() {
git reset --hard HEAD
git clean -f -d
git pull origin main
}
# Zuerst müssen wir neue Änderungen von GitHub pullen.
cd ~/apps/$APP_NAME
git_pull_force;
# Dann bauen wir das Docker Image unserer Application
cd ~/apps/$APP_NAME
docker stop $APP_NAME
docker rm $APP_NAME
docker build -t $APP_NAME .
# Create a persistent file storage
PERSISTENT_DIR="${HOME}/persistent/online-energieausweis";
mkdir -p $PERSISTENT_DIR;
# Und starten unsere App wieder.
docker run -d --name $APP_NAME --link $DB_CONTAINER_NAME \
-v "${PERSISTENT_DIR}:/persistent" \
-p "$APP_PORT:80" \
-e DB_CONNECTION=postgresql://$DB_USER:$DB_PASSWORD@${DB_CONTAINER_NAME}:$DB_PORT/$DB_NAME \
-e DB_PORT=$DB_PORT \
$APP_NAME;