Added Docker

This commit is contained in:
Tiemen van Olst
2025-09-09 08:52:28 +02:00
parent 7f1595dddd
commit 72d9f5e642
29 changed files with 10623 additions and 193 deletions

View File

@@ -1,26 +1,14 @@
#!/bin/bash
set -e
#!/bin/sh
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}
# Genereer SSL-certificaten als ze niet bestaan
if [ ! -f /app/server.crt ] || [ ! -f /app/server.key ]; then
openssl req -newkey rsa:2048 -nodes -keyout /app/server.key -x509 -days 365 -out /app/server.crt -subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=example.com"
fi
# Dependencies installeren
npm ci
# Build Nuxt
npm run build
# Start Nuxt
exec npm run start
# Start de applicatie
if [ "$NODE_ENV" = "production" ]; then
npm run build && npm run preview
else
npm install &&
npm run dev
fi