Skip to content

Commit

Permalink
fixup! Split docker makefile to move development targets into their o…
Browse files Browse the repository at this point in the history
…wn file
  • Loading branch information
g2flyer committed Jan 29, 2024
1 parent 7c5f243 commit 1996be2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ run_ccf : build_ccf stop_ccf
run_services : build_base build_services_base build_services stop_services
docker run $(DOCKER_RUN_ARGS) --name services_container -P -d pdo_services:$(PDO_VERSION)

run_client : build_base build_client
run_client : build_base build_client stop_client
docker run $(DOCKER_RUN_ARGS) -it --name client_container pdo_client:$(PDO_VERSION) \
-c "stty cols $$(tput cols) rows $$(tput lines) && bash"

Expand Down
36 changes: 26 additions & 10 deletions docker/make.dev
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,43 @@
# limitations under the License.
# ------------------------------------------------------------------------------

# This file contains targets that are useful for running docker containers for
# development. Note that these are highly specific to individual developer
# tastes and can be modified as appropriate.
# This file, included in main Makefile, contains targets that are useful for running
# docker containers for development. Note that these are highly specific to individual
# developer tastes and can be modified as appropriate.

DOCKER_DEV_CMD = stty cols $$(tput cols) rows $$(tput lines) && bash

DOCKER_DEV_ARGS = -v $(DOCKER_DIR)/xfer/:/project/pdo/xfer
DOCKER_DEV_ARGS += -v ${PDO_SOURCE_ROOT}/docker/tools/:/project/pdo/tools
DOCKER_DEV_ARGS += -v ${PDO_SOURCE_ROOT}/:/project/pdo/src
DOCKER_DEV_ARGS += --entrypoint=/bin/bash -it --network host
DOCKER_DEV_ARGS = $(DOCKER_RUN_ARGS)
DOCKER_DEV_ARGS += -v $(PDO_SOURCE_ROOT)/docker/tools/:/project/pdo/tools
DOCKER_DEV_ARGS += -v $(PDO_SOURCE_ROOT)/:/project/pdo/src
DOCKER_DEV_ARGS += --entrypoint=/bin/bash -it --rm

# sharing a pip download cache on the host can be beneficial if you have to
# restart your container, e.g., for testing client contracts with large python
# dependencies. By default, we create a local cache dir but you can have it anywhere,
# e.g., in /tmp or even pointing ~/.cache/pip (although be aware that not pip does
# not necessarily guarantee cross-version compatibility!)
PIP_CACHE_DIR ?= $(DOCKER_DIR)/cache/pip
DOCKER_DEV_ARGS += -v $(PIP_CACHE_DIR):/project/pdo/.cache/pip

# Docker runtime args specific to client
DOCKER_CLIENT_DEV_ARGS ?=
# - if you want pdo-contracts mounted in client dev image, define (e.g., in make.loc)
# variable 'DOCKER_CLIENT_WITH_PDO_CONTRACTS'
ifdef DOCKER_CLIENT_WITH_PDO_CONTRACTS
DOCKER_CLIENT_DEV_ARGS += -v $(DOCKER_DIR)/../../pdo-contracts.git:/project/pdo/contracts
endif

run_ccf_dev : build_ccf
@ docker run $(DOCKER_DEV_ARGS) --name ccf_container_dev \
docker run $(DOCKER_DEV_ARGS) --name ccf_container_dev \
-P pdo_ccf:$(PDO_VERSION) -c "$(DOCKER_DEV_CMD)"

run_services_dev : build_base build_services_base build_services
@ docker run $(DOCKER_DEV_ARGS) --name services_container_dev \
docker run $(DOCKER_DEV_ARGS) --name services_container_dev \
-P pdo_services:$(PDO_VERSION) -c "$(DOCKER_DEV_CMD)"

run_client_dev : build_base build_client
@docker run $(DOCKER_DEV_ARGS) --name client_container_dev pdo_client:$(PDO_VERSION) \
docker run $(DOCKER_CLIENT_DEV_ARGS) $(DOCKER_DEV_ARGS) --name client_container_dev pdo_client:$(PDO_VERSION) \
-c "$(DOCKER_DEV_CMD)"

stop_all : stop_ccf_dev stop_services_dev stop_client_dev
Expand Down

0 comments on commit 1996be2

Please sign in to comment.