Skip to content

Commit

Permalink
chore: do not force :Z flag in Docker volume mount
Browse files Browse the repository at this point in the history
* instead, detect if SElinux is enabled and add `:z` on demand

Signed-off-by: Hugo Hromic <[email protected]>
  • Loading branch information
hhromic committed Nov 27, 2023
1 parent d7979b4 commit 98c0a15
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ DOCKER_REPO ?= prom

SANITIZED_DOCKER_IMAGE_TAG := $(subst +,-,$(DOCKER_IMAGE_TAG))

SELINUX_ENABLED := $(shell cat /sys/fs/selinux/enforce 2> /dev/null || echo 0)

ifeq ($(SELINUX_ENABLED),1)
DOCKER_VOL_OPTS ?= :z
endif

APC_URL := https://download.schneider-electric.com/files?p_enDocType=Firmware&p_File_Name=powernet451.mib&p_Doc_Ref=APC_POWERNETMIB_451_EN
ARISTA_URL := https://www.arista.com/assets/data/docs/MIBS
CISCO_URL := https://raw.githubusercontent.com/cisco/cisco-mibs/2d465cce2de4e67a3561d8e41e4c99b597558d4b/v2
Expand Down Expand Up @@ -89,7 +95,7 @@ docker:

.PHONY: docker-generate
docker-generate: docker mibs
docker run -ti -v "${PWD}:/opt/:Z" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" generate
docker run -ti -v "${PWD}:/opt$(DOCKER_VOL_OPTS)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" generate

.PHONY: docker-publish
docker-publish:
Expand Down

0 comments on commit 98c0a15

Please sign in to comment.