<commit_before>ifndef CCPROOT
	export CCPROOT=$(GOPATH)/src/github.com/crunchydata/crunchy-containers
endif

.PHONY:	all versiontest

# Default target
all: pgimages extras

# Build images that use postgres
pgimages: commands backup backrestrestore collect pgadmin4 pgbadger pgbench pgbouncer pgdump pgpool pgrestore postgres postgres-gis upgrade node-exporter

# Build non-postgres images
extras: grafana prometheus scheduler

versiontest:
ifndef CCP_BASEOS
	$(error CCP_BASEOS is not defined)
endif
ifndef CCP_PGVERSION
	$(error CCP_PGVERSION is not defined)
endif
ifndef CCP_PG_FULLVERSION
	$(error CCP_PG_FULLVERSION is not defined)
endif
ifndef CCP_VERSION
	$(error CCP_VERSION is not defined)
endif

setup:
	$(CCPROOT)/bin/install-deps.sh

docbuild:
	cd $CCPROOT && ./generate-docs.sh

#=============================================
# Targets that generate commands (alphabetized)
#=============================================

commands: pgc

pgc:
	cd $(CCPROOT)/commands/pgc && go build pgc.go && mv pgc $(GOBIN)/pgc


#=============================================
# Targets that generate images (alphabetized)
#=============================================

backrestrestore: versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.backrest-restore.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG) $(CCPROOT)
	sudo --preserve-env buildah push $(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG) docker-daemon:$(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG)
	docker tag docker.io/$(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG) $(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_BASEOS)-$(CCP_PG_FULLVERSION)-$(CCP_VERSION)


backup:	versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.backup.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG) $(CCPROOT)
	sudo --preserve-env buildah push $(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG) docker-daemon:$(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG)
	docker tag docker.io/$(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG)  $(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG)

collect: versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.collect.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-collect:$(CCP_IMAGE_TAG) $(CCPROOT)<commit_msg>add pgbasebackuprestore target to Makefile<commit_after>ifndef CCPROOT
	export CCPROOT=$(GOPATH)/src/github.com/crunchydata/crunchy-containers
endif

.PHONY:	all versiontest

# Default target
all: pgimages extras

# Build images that use postgres
pgimages: commands backup backrestrestore pgbasebackuprestore collect pgadmin4 pgbadger pgbench pgbouncer pgdump pgpool pgrestore postgres postgres-gis upgrade node-exporter

# Build non-postgres images
extras: grafana prometheus scheduler

versiontest:
ifndef CCP_BASEOS
	$(error CCP_BASEOS is not defined)
endif
ifndef CCP_PGVERSION
	$(error CCP_PGVERSION is not defined)
endif
ifndef CCP_PG_FULLVERSION
	$(error CCP_PG_FULLVERSION is not defined)
endif
ifndef CCP_VERSION
	$(error CCP_VERSION is not defined)
endif

setup:
	$(CCPROOT)/bin/install-deps.sh

docbuild:
	cd $CCPROOT && ./generate-docs.sh

#=============================================
# Targets that generate commands (alphabetized)
#=============================================

commands: pgc

pgc:
	cd $(CCPROOT)/commands/pgc && go build pgc.go && mv pgc $(GOBIN)/pgc


#=============================================
# Targets that generate images (alphabetized)
#=============================================

backrestrestore: versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.backrest-restore.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG) $(CCPROOT)
	sudo --preserve-env buildah push $(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG) docker-daemon:$(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG)
	docker tag docker.io/$(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_IMAGE_TAG) $(CCP_IMAGE_PREFIX)/crunchy-backrest-restore:$(CCP_BASEOS)-$(CCP_PG_FULLVERSION)-$(CCP_VERSION)


backup:	versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.backup.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG) $(CCPROOT)
	sudo --preserve-env buildah push $(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG) docker-daemon:$(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG)
	docker tag docker.io/$(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG)  $(CCP_IMAGE_PREFIX)/crunchy-backup:$(CCP_IMAGE_TAG)

pgbasebackuprestore:	versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.pgbasebackup-restore.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-pgbasebackup-restore:$(CCP_IMAGE_TAG) $(CCPROOT)
	sudo --preserve-env buildah push $(CCP_IMAGE_PREFIX)/crunchy-pgbasebackup-restore:$(CCP_IMAGE_TAG) docker-daemon:$(CCP_IMAGE_PREFIX)/crunchy-pgbasebackup-restore:$(CCP_IMAGE_TAG)
	docker tag docker.io/$(CCP_IMAGE_PREFIX)/crunchy-pgbasebackup-restore:$(CCP_IMAGE_TAG)  $(CCP_IMAGE_PREFIX)/crunchy-pgbasebackup-restore:$(CCP_IMAGE_TAG)
collect: versiontest
	sudo --preserve-env buildah bud $(SQUASH) -f $(CCPROOT)/$(CCP_BASEOS)/$(CCP_PGVERSION)/Dockerfile.collect.$(CCP_BASEOS) -t $(CCP_IMAGE_PREFIX)/crunchy-collect:$(CCP_IMAGE_TAG) $(CCPROOT)
{'fraction_non_alphanumeric': 0.18595859585958596, 'fraction_numerical': 0.00036003600360036, 'mean_word_length': 7.521472392638037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1280251', 'n_tokens_mistral': 2019, 'n_tokens_neox': 1954, 'n_words': 340}