diff --git a/README.md b/README.md index 4e7b3ae..dc3f97b 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,6 @@ After generating a new repo from the Sparkpress template, you will need to chang - [ ] `.github/workflows/deploy.docker.yml` (references to the container registry or delete the file if not using a docker deployment process) - [ ] `.github/workflows/deploy.pantheon.yml` (theme folder names) - [ ] `.github/workflows/release-please.yml` (`package-name` field) - - [ ] `scripts/export-db.sh` (db container name) - - [ ] `scripts/import-db.sh` (db container names) - [ ] `src/php/style.css` (theme name plus the other metadata in the file) - [ ] `src/php/inc/theme-scripts.php` (metadata and prefixes for function/script names) - [ ] `src/php/inc/theme-setup.php` (metadata and prefixes for function names) diff --git a/scripts/export-db.sh b/scripts/export-db.sh index bc5f447..eca1823 100755 --- a/scripts/export-db.sh +++ b/scripts/export-db.sh @@ -23,7 +23,7 @@ fi mkdir -p $path # generate SQL dump -docker exec -i sparkpress_db mysqldump --user=root --password=$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE > $path/$prefix-raw.sql +docker compose exec -i db mysqldump --user=root --password=$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE > $path/$prefix-raw.sql # replace localhost URLs with target environment URL sed "s/http:\/\/localhost:8000/$SITE_URL/g" $path/$prefix-raw.sql > $filename diff --git a/scripts/import-db.sh b/scripts/import-db.sh index e009ff1..a6f18c6 100755 --- a/scripts/import-db.sh +++ b/scripts/import-db.sh @@ -16,9 +16,9 @@ gunzip sql/db-import-raw.sql.gz sed "s/$SITE_URL/http:\/\/localhost:8000/g" sql/db-import-raw.sql > sql/db-import.sql # drop existing database, create a new one, and load it up with data -docker exec -i sparkpress_db mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD -e "drop database if exists $MYSQL_DATABASE" -docker exec -i sparkpress_db mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD -e "create database $MYSQL_DATABASE" -docker exec -i sparkpress_db mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD $MYSQL_DATABASE < sql/db-import.sql +docker compose exec -i db mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD -e "drop database if exists $MYSQL_DATABASE" +docker compose exec -i db mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD -e "create database $MYSQL_DATABASE" +docker compose exec -iT db mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD $MYSQL_DATABASE < sql/db-import.sql # clean up files that aren't useful after import rm sql/db-import* diff --git a/scripts/run.sh b/scripts/run.sh index c45ff22..e93531a 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -12,5 +12,6 @@ if [ "$CI" == "true" ]; then exec "$@" else # Run the command inside the Docker container - docker compose run --rm --no-deps --remove-orphans web "$@" + # use exec if the container's already running, or spin up a temporary container to run it + docker compose exec -it web "$@" || docker compose run --rm --no-deps --remove-orphans web "$@" fi