This commit is contained in:
1 parent
60515393f5
commit
dc90d6ec36
1 file changed
+18
-2
@@ -24,6 +24,11 @@ jobs:
|
|||||||
}
|
}
|
||||||
trap 'error_handler $LINENO' ERR
|
trap 'error_handler $LINENO' ERR
|
||||||
|
|
||||||
|
# Zorg dat de externe opslagmap bestaat met de juiste rechten
|
||||||
|
sudo mkdir -p /var/www/atom-media
|
||||||
|
sudo chown -R www-data:www-data /var/www/atom-media
|
||||||
|
sudo chmod -R 775 /var/www/atom-media
|
||||||
|
|
||||||
# 2. Cleanup & Git Sync
|
# 2. Cleanup & Git Sync
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
cd /var/www/atom-nexst/
|
cd /var/www/atom-nexst/
|
||||||
@@ -32,13 +37,20 @@ jobs:
|
|||||||
|
|
||||||
git fetch origin --prune
|
git fetch origin --prune
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
git clean -fd -e .env -e .env.local -e .env.production -e .env*.local -e .next
|
|
||||||
|
|
||||||
|
# -e public/uploads zorgt dat git clean je media-link/map in de hoofdmap negeert
|
||||||
|
git clean -fd -e .env -e .env.local -e .env.production -e .env*.local -e .next -e public/uploads
|
||||||
|
|
||||||
|
# Zorg dat public/uploads in de hoofdmap altijd gekoppeld is
|
||||||
|
if [ ! -L public/uploads ]; then
|
||||||
|
rm -rf public/uploads
|
||||||
|
ln -s /var/www/atom-media public/uploads
|
||||||
|
fi
|
||||||
|
|
||||||
# Verwijder oude builds, behoud de cache voor snelheid
|
# Verwijder oude builds, behoud de cache voor snelheid
|
||||||
find .next -mindepth 1 -maxdepth 1 ! -name 'cache' -exec rm -rf {} + 2>/dev/null || true
|
find .next -mindepth 1 -maxdepth 1 ! -name 'cache' -exec rm -rf {} + 2>/dev/null || true
|
||||||
|
|
||||||
# 3. Environment Sanitization
|
# 3. Environment Sanitization
|
||||||
# Zorgt ervoor dat gecachte omgevingsvariabelen met 'connect_timeout' de mysql2 driver niet storen
|
|
||||||
if [ -f .env ]; then
|
if [ -f .env ]; then
|
||||||
export $(grep -v '^#' .env | xargs)
|
export $(grep -v '^#' .env | xargs)
|
||||||
export DATABASE_URL=$(echo "$DATABASE_URL" | sed 's/[&?]connect_timeout=[^&]*//g')
|
export DATABASE_URL=$(echo "$DATABASE_URL" | sed 's/[&?]connect_timeout=[^&]*//g')
|
||||||
@@ -65,6 +77,10 @@ jobs:
|
|||||||
cp -r node_modules/@prisma .next/standalone/node_modules/ 2>/dev/null || true
|
cp -r node_modules/@prisma .next/standalone/node_modules/ 2>/dev/null || true
|
||||||
cp .env .next/standalone/.env
|
cp .env .next/standalone/.env
|
||||||
|
|
||||||
|
# Koppel de uploads symlink binnen de nieuwe standalone distributie
|
||||||
|
rm -rf .next/standalone/public/uploads
|
||||||
|
ln -s /var/www/atom-media .next/standalone/public/uploads
|
||||||
|
|
||||||
# 7. Permissions & Restart
|
# 7. Permissions & Restart
|
||||||
sudo chown -R www-data:www-data /var/www/atom-nexst/
|
sudo chown -R www-data:www-data /var/www/atom-nexst/
|
||||||
sudo chmod -R g+rw /var/www/atom-nexst/
|
sudo chmod -R g+rw /var/www/atom-nexst/
|
||||||
|
|||||||
Reference in new issue
Block a user