forked from nginx/ngx-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainer.mk
28 lines (25 loc) · 1.69 KB
/
container.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.PHONY: container-debian-build-image
.ONESHELL: container-debian-build-image
container-debian-build-image:
container-debian-build-image: ## Builds a container image for building on Debian Linux
$Q echo "$(M) building debian linux docker build image: $(@)"
$(DOCKER) buildx build $(DOCKER_BUILD_FLAGS) -t debian-ngx-rust-builder -f Containerfile.debian $(CURDIR);
.PHONY: container-test
container-test: container-debian-build-image ## Run tests inside container
$Q mkdir -p .cache/cargo nginx-sys/.nginx
$(DOCKER) run --rm --volume "$(CURDIR):/project" --workdir /project --env 'CARGO_HOME=/project/.cache/cargo' debian-ngx-rust-builder make test
# Reset permissions on the target directory to the current user
if command -v id > /dev/null; then \
$(DOCKER) run --rm --volume "$(CURDIR):/project" --workdir /project debian-ngx-rust-builder chown --silent --recursive "$(shell id -u):$(shell id -g)" /project/target /project/.cache /project/nginx-sys/.nginx
fi
.PHONY: container-shell
container-shell: container-debian-build-image ## Start a shell inside container
$Q mkdir -p .cache/cargo nginx-sys/.nginx
$(DOCKER) run -it --rm --volume "$(CURDIR):/project" --workdir /project --env 'CARGO_HOME=/project/.cache/cargo' debian-ngx-rust-builder bash
# Reset permissions on the target directory to the current user
if command -v id > /dev/null; then \
$(DOCKER) run --rm --volume "$(CURDIR):/project" --workdir /project debian-ngx-rust-builder chown --silent --recursive "$(shell id -u):$(shell id -g)" /project/target /project/.cache /project/nginx-sys/.nginx
fi
.PHONY: build-docker
build-docker: ## build docker image with all example modules
$(DOCKER) buildx build $(DOCKER_BUILD_FLAGS) -t $(PROJECT_NAME) .