27 lines
542 B
Bash
27 lines
542 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
TEMP_DIR="/tmp/nuxt_repo"
|
|
|
|
# Als repo nog niet bestaat, clone naar tijdelijke map
|
|
if [ ! -d ".git" ]; then
|
|
echo "Cloning repo to temporary folder..."
|
|
git clone -b ${GIT_BRANCH:-main} ${GIT_REPO_URL} $TEMP_DIR
|
|
echo "Copying files to /app..."
|
|
cp -R $TEMP_DIR/* $TEMP_DIR/.[!.]* /app/ 2>/dev/null || true
|
|
else
|
|
echo "Pulling latest changes..."
|
|
git reset --hard
|
|
git clean -fd
|
|
git pull origin ${GIT_BRANCH:-main}
|
|
fi
|
|
|
|
# Dependencies installeren
|
|
npm ci
|
|
|
|
# Build Nuxt
|
|
npm run build
|
|
|
|
# Start Nuxt
|
|
exec npm run start
|