2023-09-21 19:37:37 +00:00
|
|
|
project := dkr-dsg.ac.upc.edu/ereuse
|
2023-09-19 16:03:23 +00:00
|
|
|
|
|
|
|
branch := `git branch --show-current`
|
|
|
|
commit := `git log -1 --format=%h`
|
2024-02-16 10:01:46 +00:00
|
|
|
#tag := ${branch}__${commit}
|
|
|
|
tag := latest
|
2023-09-19 16:03:23 +00:00
|
|
|
|
|
|
|
# docker images
|
|
|
|
devicehub_image := ${project}/devicehub:${tag}
|
|
|
|
postgres_image := ${project}/postgres:${tag}
|
|
|
|
|
|
|
|
# 2. Create a virtual environment.
|
|
|
|
docker_build:
|
|
|
|
docker build -f docker/devicehub.Dockerfile -t ${devicehub_image} .
|
|
|
|
# DEBUG
|
|
|
|
#docker build -f docker/devicehub.Dockerfile -t ${devicehub_image} . --progress=plain --no-cache
|
|
|
|
|
|
|
|
docker build -f docker/postgres.Dockerfile -t ${postgres_image} .
|
|
|
|
# DEBUG
|
|
|
|
#docker build -f docker/postgres.Dockerfile -t ${postgres_image} . --progress=plain --no-cache
|
2023-09-21 19:37:37 +00:00
|
|
|
@printf "\n##########################\n"
|
|
|
|
@printf "\ndevicehub image: ${devicehub_image}\n"
|
|
|
|
@printf "postgres image: ${postgres_image}\n"
|
|
|
|
@printf "\ndocker images built\n"
|
|
|
|
@printf "\n##########################\n\n"
|
2023-09-19 16:03:23 +00:00
|
|
|
|
|
|
|
docker_publish:
|
|
|
|
docker push ${devicehub_image}
|
2023-09-19 16:15:16 +00:00
|
|
|
docker push ${postgres_image}
|
2023-09-19 16:03:23 +00:00
|
|
|
|
|
|
|
.PHONY: docker
|
|
|
|
docker:
|
|
|
|
$(MAKE) docker_build
|
2023-09-19 16:15:16 +00:00
|
|
|
$(MAKE) docker_publish
|
2023-09-21 19:37:37 +00:00
|
|
|
@printf "\ndocker images published\n"
|
2023-09-29 08:51:48 +00:00
|
|
|
|
|
|
|
# manage 2 kinds of deployments with docker compose
|
|
|
|
|
|
|
|
dc_up_devicehub:
|
|
|
|
docker compose -f docker-compose_devicehub.yml up || true
|
|
|
|
|
|
|
|
dc_down_devicehub:
|
|
|
|
docker compose -f docker-compose_devicehub.yml down -v || true
|
|
|
|
|
|
|
|
dc_up_devicehub_dpp:
|
|
|
|
docker compose -f docker-compose_devicehub-dpp.yml up || true
|
|
|
|
|
|
|
|
dc_down_devicehub_dpp:
|
|
|
|
docker compose -f docker-compose_devicehub-dpp.yml down -v || true
|