Skip to content

Commit

Permalink
Use an empty context for docker/podman image building
Browse files Browse the repository at this point in the history
  • Loading branch information
liweitianux committed Dec 11, 2024
1 parent a8f18c5 commit 23b997e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ cleanall:
.PHONY: all en zh dist clean cleanall

DOCKER_CLI?= sudo docker
DOCKER_IMAGE:= resume:builder
DOCKER_IMAGE:= resume:test
DOCKER_CHOWN:= chown -R $(shell id -u):$(shell id -g) .

# build the resume within an docker container
docker:
$(DOCKER_CLI) image inspect -f 'ok' $(DOCKER_IMAGE) 2>/dev/null || \
$(DOCKER_CLI) build --tag $(DOCKER_IMAGE) -f Dockerfile .
{ \
rm -rf _empty && \
mkdir _empty && \
$(DOCKER_CLI) build --tag $(DOCKER_IMAGE) \
-f Dockerfile _empty && \
rmdir _empty; \
}
$(DOCKER_CLI) run --rm --volume $(PWD):/build $(DOCKER_IMAGE) \
sh -c "cd /build && make clean && make && $(DOCKER_CHOWN)"

Expand Down

0 comments on commit 23b997e

Please sign in to comment.