Skip to content

Commit

Permalink
fixup! Some minor docker improvements
Browse files Browse the repository at this point in the history
Signed-off-by: g2flyer <[email protected]>
  • Loading branch information
g2flyer authored and cmickeyb committed Jan 19, 2024
1 parent 8191288 commit 155883c
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PDO_GROUP_UID ?= $(shell id -g)
# Turns out that setting the script directory from the Makefile's name
# does not work very well if the path contains spaces in the name; in
# fact lots of things break very badly; set this explicitly
SCRIPT_DIR ?= ${PDO_SOURCE_ROOT}/docker
DOCKER_DIR ?= ${PDO_SOURCE_ROOT}/docker

DOCKER_USERNAME = $(LOGNAME)
DOCKER_BUILDARGS += --build-arg PDO_HOSTNAME=$(PDO_HOSTNAME)
Expand All @@ -62,36 +62,54 @@ rebuild_% : repository
--build-arg REBUILD=$(TIMESTAMP) \
--build-arg PDO_VERSION=${PDO_VERSION} \
--tag pdo_$*:${PDO_VERSION} \
--file $(SCRIPT_DIR)/pdo_$*.dockerfile .
--file $(DOCKER_DIR)/pdo_$*.dockerfile .

build_% : repository
@ docker build $(DOCKER_ARGS) \
--build-arg PDO_VERSION=${PDO_VERSION} \
--tag pdo_$*:${PDO_VERSION} \
--file $(SCRIPT_DIR)/pdo_$*.dockerfile .
--file $(DOCKER_DIR)/pdo_$*.dockerfile .

clean_% :
@ docker rmi -f pdo_$*:${PDO_VERSION}

run_ccf : build_ccf stop_ccf
@ docker run -v $(SCRIPT_DIR)/xfer/:/project/pdo/xfer --network host --name ccf_container -P -d pdo_ccf:${PDO_VERSION}
@ docker run -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer --network host --name ccf_container -P -d pdo_ccf:${PDO_VERSION}

run_ccf_dev : build_ccf
@ docker run -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer -v ${PDO_SOURCE_ROOT}/docker/tools/:/project/pdo/tools -v ${PDO_SOURCE_ROOT}/:/project/pdo/src --entrypoint=/bin/bash -it --network host --name ccf_container_dev -P pdo_ccf:${PDO_VERSION} -c "stty cols $$(tput cols) rows $$(tput lines) && bash"

run_services : build_base build_services_base build_services stop_services
@ docker run -v $(SCRIPT_DIR)/xfer/:/project/pdo/xfer --network host --name services_container -P -d pdo_services:${PDO_VERSION}
@ docker run -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer --network host --name services_container -P -d pdo_services:${PDO_VERSION}

run_services_dev : build_base build_services_base build_services
@ docker run -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer -v ${PDO_SOURCE_ROOT}/docker/tools/:/project/pdo/tools -v ${PDO_SOURCE_ROOT}/:/project/pdo/src --entrypoint=/bin/bash -it --network host --name services_container_dev -P pdo_services:${PDO_VERSION} -c "stty cols $$(tput cols) rows $$(tput lines) && bash"

run_client : build_base build_client
@docker run -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer -it --network host --name client_container pdo_client:${PDO_VERSION} -c "stty cols $$(tput cols) rows $$(tput lines) && bash"

run_client : build_base build_client stop_client
@docker run -v $(SCRIPT_DIR)/xfer/:/project/pdo/xfer -it --network host --name client_container pdo_client:${PDO_VERSION} -c "stty cols $$(tput cols) rows $$(tput lines) && bash"
run_client_dev : build_base build_client
@docker run -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer -v ${PDO_SOURCE_ROOT}/docker/tools/:/project/pdo/tools -v ${PDO_SOURCE_ROOT}/:/project/pdo/src --entrypoint=/bin/bash -it --network host --name client_container_dev pdo_client:${PDO_VERSION} -c "stty cols $$(tput cols) rows $$(tput lines) && bash"

stop_all : stop_ccf stop_services stop_client
stop_all : stop_ccf stop_services stop_client stop_ccf_dev stop_services_dev stop_client_dev

stop_ccf :
- docker rm -f ccf_container

stop_ccf_dev :
- docker rm -f ccf_container_dev

stop_services :
- docker rm -f services_container

stop_services_dev :
- docker rm -f services_container_dev

stop_client :
- docker rm -f client_container

stop_client_dev :
- docker rm -f client_container_dev
# -----------------------------------------------------------------
# We need a repository with the source for the branch we are going
# to build. In theory this could just be a copy of the local source
Expand Down Expand Up @@ -140,9 +158,9 @@ clean_images : $(addprefix clean_,$(IMAGES))
@ if [ ! -z "$(_IMAGES_)" ]; then docker rmi -f $(_IMAGES_); fi

clean_config :
@ rm -f $(SCRIPT_DIR)/xfer/ccf/keys/*.pem $(SCRIPT_DIR)/xfer/ccf/etc/*.toml
@ rm -f $(SCRIPT_DIR)/xfer/services/keys/*.pem $(SCRIPT_DIR)/xfer/services/etc/*.toml
@ rm -f $(SCRIPT_DIR)/xfer/services/etc/site.psh
@ rm -f $(DOCKER_DIR)/xfer/ccf/keys/*.pem $(DOCKER_DIR)/xfer/ccf/etc/*.toml
@ rm -f $(DOCKER_DIR)/xfer/services/keys/*.pem $(DOCKER_DIR)/xfer/services/etc/*.toml
@ rm -f $(DOCKER_DIR)/xfer/services/etc/site.psh

clean : clean_images clean_config clean_repository

Expand Down

0 comments on commit 155883c

Please sign in to comment.