-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# Change directory to the bookworm folder | ||
cd /opt/bookworm | ||
# Stash any local changes | ||
git stash | ||
# Checkout main branch if not already on it | ||
git checkout main | ||
# Pull any changes | ||
git pull | ||
# Stop and remove containers | ||
docker compose down | ||
# Remove locally built images | ||
echo "Deleting locally built Docker images" | ||
docker image rm $(docker images "bookworm-**" -q) | ||
# Delete app volume | ||
echo "Deleting app volume" | ||
# Build containers | ||
echo "Building docker images" | ||
docker compose build | ||
# Restart containers | ||
echo "Restarting Docker containers" | ||
docker compose up -d | ||
# Run Database migrations if necessary | ||
echo "Running Database Migrations" | ||
docker exec -i $(docker ps --filter name=rails -q) bash -lc "bundle exec rails db:migrate RAILS_ENV=production" |