Skip to content

Commit

Permalink
The Makefile is only useful for local development these days
Browse files Browse the repository at this point in the history
  • Loading branch information
justinclift committed Oct 7, 2024
1 parent 6a58281 commit 61d059f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 78 deletions.
91 changes: 17 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,110 +1,53 @@
.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 -f Dockerfile.alpine --build-arg PGTARGET=12 -t pgautoupgrade/pgautoupgrade:12-dev . && \
docker build -f Dockerfile.bookworm --build-arg PGTARGET=12 -t pgautoupgrade/pgautoupgrade:12-dev-bookworm .

13dev:
docker build -f Dockerfile.alpine --build-arg PGTARGET=13 -t pgautoupgrade/pgautoupgrade:13-dev . && \
docker build -f Dockerfile.bookworm --build-arg PGTARGET=13 -t pgautoupgrade/pgautoupgrade:13-dev-bookworm .

14dev:
docker build -f Dockerfile.alpine --build-arg PGTARGET=14 -t pgautoupgrade/pgautoupgrade:14-dev . && \
docker build -f Dockerfile.bookworm --build-arg PGTARGET=14 -t pgautoupgrade/pgautoupgrade:14-dev-bookworm .

15dev:
docker build -f Dockerfile.alpine --build-arg PGTARGET=15 -t pgautoupgrade/pgautoupgrade:15-dev . && \
docker build -f Dockerfile.bookworm --build-arg PGTARGET=15 -t pgautoupgrade/pgautoupgrade:15-dev-bookworm .

16dev:
docker build -f Dockerfile.alpine -t pgautoupgrade/pgautoupgrade:16-dev -t pgautoupgrade/pgautoupgrade:dev . && \
docker build -f Dockerfile.bookworm -t pgautoupgrade/pgautoupgrade:16-dev-bookworm -t pgautoupgrade/pgautoupgrade:dev-bookworm .

prod:
docker build -f Dockerfile.alpine --build-arg PGTARGET=15 -t pgautoupgrade/pgautoupgrade:15-alpine3.20 -t pgautoupgrade/pgautoupgrade:15-alpine . && \
docker build -f Dockerfile.alpine -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

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:dev-bookworm \
pgautoupgrade/pgautoupgrade:12-dev \
pgautoupgrade/pgautoupgrade:12-dev-bookworm \
pgautoupgrade/pgautoupgrade:13-dev \
pgautoupgrade/pgautoupgrade:13-dev-bookworm \
pgautoupgrade/pgautoupgrade:14-dev \
pgautoupgrade/pgautoupgrade:14-dev-bookworm \
pgautoupgrade/pgautoupgrade:15-dev \
pgautoupgrade/pgautoupgrade:15-dev-bookworm \
pgautoupgrade/pgautoupgrade:16-dev \
pgautoupgrade/pgautoupgrade:16-dev-bookworm \
pgautoupgrade/pgautoupgrade:15-alpine \
pgautoupgrade/pgautoupgrade:15-bookworm \
pgautoupgrade/pgautoupgrade:16-alpine \
pgautoupgrade/pgautoupgrade:16-bookworm \
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

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:12-dev-bookworm && \
docker push pgautoupgrade/pgautoupgrade:13-dev && \
docker push pgautoupgrade/pgautoupgrade:13-dev-bookworm && \
docker push pgautoupgrade/pgautoupgrade:14-dev && \
docker push pgautoupgrade/pgautoupgrade:14-dev-bookworm && \
docker push pgautoupgrade/pgautoupgrade:15-dev && \
docker push pgautoupgrade/pgautoupgrade:15-dev-bookworm && \
docker push pgautoupgrade/pgautoupgrade:16-dev && \
docker push pgautoupgrade/pgautoupgrade:16-dev-bookworm && \
docker push pgautoupgrade/pgautoupgrade:dev && \
docker push pgautoupgrade/pgautoupgrade:dev-bookworm

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
docker tag pgautoupgrade/pgautoupgrade:local pgautoupgrade/pgautoupgrade:dev
docker push pgautoupgrade/pgautoupgrade:dev
docker image rm pgautoupgrade/pgautoupgrade:dev
11 changes: 7 additions & 4 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 61d059f

Please sign in to comment.