Fix: linux (w/ selinux) build (#2004)

* add: check for selinux for vol mount

* update: install packages first

build time not increased if script changes

* update: selinux check
This commit is contained in:
Cory Latschkowski 2024-04-14 03:51:17 -05:00 committed by GitHub
parent a4b9c3049b
commit c7baa8bc34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View File

@ -1,12 +1,15 @@
FROM golang:1.22.1 FROM golang:1.22.1
RUN apt-get update && \
apt-get install -y npm && \
npm install -g npx cspell@latest
COPY scripts/devtools.sh /opt/devtools.sh COPY scripts/devtools.sh /opt/devtools.sh
RUN set -e -x \ RUN set -e -x && \
&& /opt/devtools.sh /opt/devtools.sh
ENV PATH=/go/bin:$PATH
RUN apt-get update && apt-get install -y npm && npm install -g npx cspell@latest ENV PATH=/go/bin:$PATH
ENV CGO_ENABLED 0 ENV CGO_ENABLED 0
ENV GOPATH /go:/yq ENV GOPATH /go:/yq

View File

@ -26,6 +26,7 @@ ifeq ($(CYG_CHECK),1)
else else
# all non-windows environments # all non-windows environments
ROOT := $(shell pwd) ROOT := $(shell pwd)
SELINUX := $(shell which getenforce 2>&1 >/dev/null && echo :z)
endif endif
DEV_IMAGE := ${PROJECT}_dev DEV_IMAGE := ${PROJECT}_dev
@ -33,7 +34,7 @@ DEV_IMAGE := ${PROJECT}_dev
ENGINERUN := ${ENGINE} run --rm \ ENGINERUN := ${ENGINE} run --rm \
-e LDFLAGS="${LDFLAGS}" \ -e LDFLAGS="${LDFLAGS}" \
-e GITHUB_TOKEN="${GITHUB_TOKEN}" \ -e GITHUB_TOKEN="${GITHUB_TOKEN}" \
-v ${ROOT}/vendor:/go/src \ -v ${ROOT}/vendor:/go/src${SELINUX} \
-v ${ROOT}:/${PROJECT}/src/${IMPORT_PATH} \ -v ${ROOT}:/${PROJECT}/src/${IMPORT_PATH}${SELINUX} \
-w /${PROJECT}/src/${IMPORT_PATH} \ -w /${PROJECT}/src/${IMPORT_PATH} \
${DEV_IMAGE} ${DEV_IMAGE}