diff --git a/Makefile b/Makefile index 5a169b9..d2d0c42 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,7 @@ -.PHONY: all dev 13dev 14dev 15dev prod attach before clean down server test up pushdev pushprod +.PHONY: local attach before clean down server test up pushdev -all: 12dev 13dev 14dev 15dev 16dev prod - -dev: 16dev - -12dev: - docker build --build-arg PGTARGET=12 -t pgautoupgrade/pgautoupgrade:12-dev . - -13dev: - docker build --build-arg PGTARGET=13 -t pgautoupgrade/pgautoupgrade:13-dev . - -14dev: - docker build --build-arg PGTARGET=14 -t pgautoupgrade/pgautoupgrade:14-dev . - -15dev: - docker build --build-arg PGTARGET=15 -t pgautoupgrade/pgautoupgrade:15-dev . - -16dev: - docker build -t pgautoupgrade/pgautoupgrade:16-dev -t pgautoupgrade/pgautoupgrade:dev . - -prod: - docker build --build-arg PGTARGET=15 -t pgautoupgrade/pgautoupgrade:15-alpine3.20 -t pgautoupgrade/pgautoupgrade:15-alpine . && \ - docker build -t pgautoupgrade/pgautoupgrade:16-alpine3.20 -t pgautoupgrade/pgautoupgrade:16-alpine -t pgautoupgrade/pgautoupgrade:latest . +local: + docker build -f Dockerfile.alpine -t pgautoupgrade/pgautoupgrade:local . attach: docker exec -it pgauto /bin/bash @@ -29,32 +9,31 @@ attach: before: if [ ! -d "test/postgres-data" ]; then \ mkdir test/postgres-data; \ - fi && \ + fi docker run --name pgauto -it --rm \ --mount type=bind,source=$(abspath $(CURDIR))/test/postgres-data,target=/var/lib/postgresql/data \ -e POSTGRES_PASSWORD=password \ -e PGAUTO_DEVEL=before \ - pgautoupgrade/pgautoupgrade:dev + pgautoupgrade/pgautoupgrade:local clean: - docker image rm --force pgautoupgrade/pgautoupgrade:dev pgautoupgrade/pgautoupgrade:12-dev pgautoupgrade/pgautoupgrade:13-dev \ - pgautoupgrade/pgautoupgrade:14-dev pgautoupgrade/pgautoupgrade:15-dev pgautoupgrade/pgautoupgrade:16-dev \ - pgautoupgrade/pgautoupgrade:15-alpine pgautoupgrade/pgautoupgrade:16-alpine \ - pgautoupgrade/pgautoupgrade:15-alpine3.20 pgautoupgrade/pgautoupgrade:16-alpine3.20 pgautoupgrade/pgautoupgrade:latest && \ - docker image prune -f && \ + docker image rm --force \ + pgautoupgrade/pgautoupgrade:dev \ + pgautoupgrade/pgautoupgrade:local + docker image prune -f docker volume prune -f down: - ./test.sh down + docker container stop pgauto server: if [ ! -d "test/postgres-data" ]; then \ mkdir test/postgres-data; \ - fi && \ + fi docker run --name pgauto -it --rm --mount type=bind,source=$(abspath $(CURDIR))/test/postgres-data,target=/var/lib/postgresql/data \ -e POSTGRES_PASSWORD=password \ -e PGAUTO_DEVEL=server \ - pgautoupgrade/pgautoupgrade:dev + pgautoupgrade/pgautoupgrade:local test: ./test.sh @@ -62,23 +41,13 @@ test: up: if [ ! -d "test/postgres-data" ]; then \ mkdir test/postgres-data; \ - fi && \ + fi docker run --name pgauto -it --rm \ --mount type=bind,source=$(abspath $(CURDIR))/test/postgres-data,target=/var/lib/postgresql/data \ -e POSTGRES_PASSWORD=password \ - pgautoupgrade/pgautoupgrade:dev + pgautoupgrade/pgautoupgrade:local pushdev: - docker push pgautoupgrade/pgautoupgrade:12-dev && \ - docker push pgautoupgrade/pgautoupgrade:13-dev && \ - docker push pgautoupgrade/pgautoupgrade:14-dev && \ - docker push pgautoupgrade/pgautoupgrade:15-dev && \ - docker push pgautoupgrade/pgautoupgrade:16-dev && \ + docker tag pgautoupgrade/pgautoupgrade:local pgautoupgrade/pgautoupgrade:dev docker push pgautoupgrade/pgautoupgrade:dev - -pushprod: - docker push pgautoupgrade/pgautoupgrade:15-alpine3.20 && \ - docker push pgautoupgrade/pgautoupgrade:15-alpine && \ - docker push pgautoupgrade/pgautoupgrade:16-alpine3.20 && \ - docker push pgautoupgrade/pgautoupgrade:16-alpine && \ - docker push pgautoupgrade/pgautoupgrade:latest \ No newline at end of file + docker image rm pgautoupgrade/pgautoupgrade:dev diff --git a/README.md b/README.md index 3cf953d..6478e8b 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ To build the development docker image, use: $ make dev ``` -This will take a few minutes to create the "pgautoupgrade:latest" +This will take a few minutes to create the "pgautoupgrade:local" docker image, that you can use in your docker-compose.yml files. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 34f3df2..9dc10c0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -361,9 +361,9 @@ _main() { # executing local UPGRADE_PERFORMED=0 if [ "x${PGAUTO_DEVEL}" = "xbefore" ]; then - echo "---------------------------------------------------------------------------" - echo "In pgautoupgrade development mode, paused prior to pgautoupgrade scripting." - echo "---------------------------------------------------------------------------" + echo "--------------------------------------------------------------------------" + echo "In pgautoupgrade development mode, paused prior to pgautoupgrade scripting" + echo "--------------------------------------------------------------------------" while :; do sleep 5 done @@ -588,7 +588,10 @@ _main() { # For development of pgautoupgrade. This spot leaves the container running, after the pgautoupgrade scripting has # executed, but without subsequently running the PostgreSQL server if [ "x${PGAUTO_DEVEL}" = "xserver" ]; then - echo "In pgautoupgrade development mode, so database server not started." + echo "-------------------------------------------------------------------" + echo "In pgautoupgrade development mode, paused after main pg_upgrade has" + echo "run, but before database server and post-upgrade tasks have started" + echo "-------------------------------------------------------------------" while :; do sleep 5 done