Skip to content

Commit

Permalink
tooling: Add targets to Makefile.docker for building and running dev …
Browse files Browse the repository at this point in the history
…container
  • Loading branch information
cassava committed Mar 27, 2024
1 parent c0e9c04 commit 8e766a2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DOCKER := DOCKER_BUILDKIT=1 docker
DOCKER_IMAGE_NAME := cloe/cloe-engine
DOCKER_IMAGE_VERSION := ${PROJECT_VERSION}
DOCKER_IMAGE := ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION}
DOCKER_DEVIMAGE := ${DOCKER_IMAGE_NAME}-dev:${DOCKER_IMAGE_VERSION}
DOCKER_CONTEXT := ${PROJECT_ROOT}

DOCKER_USER_ARGS +=
Expand Down Expand Up @@ -115,6 +116,13 @@ ubuntu-%: FORCE build-ubuntu-% test-ubuntu-%
.PHONY: all
all: $(addprefix ubuntu-,${UBUNTU_VERSIONS})

build-devc-%: FORCE Dockerfile
${DOCKER} build -f Dockerfile ${DOCKER_BUILD_ARGS} ${DOCKER_USER_ARGS} \
--build-arg UBUNTU_VERSION=$* \
--target stage-setup-system \
-t ${DOCKER_DEVIMAGE}-ubuntu-$* \
${DOCKER_CONTEXT}

build-ubuntu-%: FORCE Dockerfile
${DOCKER} build -f Dockerfile ${DOCKER_BUILD_ARGS} ${DOCKER_USER_ARGS} \
--build-arg UBUNTU_VERSION=$* \
Expand All @@ -125,6 +133,9 @@ test-ubuntu-%: FORCE
docker run ${DOCKER_RUN_ARGS} ${DOCKER_USER_ARGS} ${DOCKER_IMAGE}-ubuntu-$* \
bash -ec "[ -f /root/setup.sh ] && source /root/setup.sh; make smoketest"

run-devc-%: FORCE
docker run -it ${DOCKER_RUN_ARGS} ${DOCKER_USER_ARGS} --mount type=bind,source=$$(pwd),destination=/cloe ${DOCKER_DEVIMAGE}-ubuntu-$*

run-ubuntu-%: FORCE
docker run -it ${DOCKER_RUN_ARGS} ${DOCKER_USER_ARGS} ${DOCKER_IMAGE}-ubuntu-$*

Expand Down

0 comments on commit 8e766a2

Please sign in to comment.