From c9b7d81508b42c83015b7dc3a4845bed664178a5 Mon Sep 17 00:00:00 2001 From: Brendan Bergen Date: Wed, 20 Mar 2024 05:24:18 -0600 Subject: [PATCH] Add CI containerfile for portal javascript build (#3397) * Add CI containerfile for portal NPM commands + makefile target * Update docs to reflect new envvar for makefile, including a reasonable default for local dev: NO_CACHE --- Dockerfile.ci-portal | 13 +++++++++++++ Makefile | 6 +++++- env.example | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.ci-portal diff --git a/Dockerfile.ci-portal b/Dockerfile.ci-portal new file mode 100644 index 00000000000..d54d1af075f --- /dev/null +++ b/Dockerfile.ci-portal @@ -0,0 +1,13 @@ +ARG REGISTRY + +FROM ${REGISTRY}/ubi8/nodejs-16 AS portal-base +WORKDIR /build/portal/v2 +USER root + +FROM portal-base AS portal-build +COPY /portal/v2/package*.json ./ +RUN npm ci +RUN npm audit --omit=dev +COPY /portal/v2/ ./ +RUN npm run lint +RUN npm run build \ No newline at end of file diff --git a/Makefile b/Makefile index e6bf24c3e61..2c31d5cdeaa 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ COMMIT = $(shell git rev-parse --short=7 HEAD)$(shell [[ $$(git status --porcela ARO_IMAGE_BASE = ${RP_IMAGE_ACR}.azurecr.io/aro E2E_FLAGS ?= -test.v --ginkgo.v --ginkgo.timeout 180m --ginkgo.flake-attempts=2 --ginkgo.junit-report=e2e-report.xml GO_FLAGS ?= -tags=containers_image_openpgp,exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper +NO_CACHE ?= true export GOFLAGS=$(GO_FLAGS) @@ -75,6 +76,9 @@ clean: client: generate hack/build-client.sh "${AUTOREST_IMAGE}" 2020-04-30 2021-09-01-preview 2022-04-01 2022-09-04 2023-04-01 2023-07-01-preview 2023-09-04 2023-11-22 2024-08-12-preview +ci-portal: + docker build . -f Dockerfile.ci-portal --build-arg REGISTRY=$(REGISTRY) --no-cache=$(NO_CACHE) + # TODO: hard coding dev-config.yaml is clunky; it is also probably convenient to # override COMMIT. deploy: @@ -266,4 +270,4 @@ vendor: install-go-tools: go install ${GOTESTSUM} -.PHONY: admin.kubeconfig aks.kubeconfig aro az clean client deploy dev-config.yaml discoverycache generate image-aro-multistage image-fluentbit image-proxy lint-go runlocal-rp proxy publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go validate-fips install-go-tools +.PHONY: admin.kubeconfig aks.kubeconfig aro az ci-portal clean client deploy dev-config.yaml discoverycache generate image-aro-multistage image-fluentbit image-proxy lint-go runlocal-rp proxy publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go validate-fips install-go-tools \ No newline at end of file diff --git a/env.example b/env.example index edff2b1dd7c..7cea448a1c0 100644 --- a/env.example +++ b/env.example @@ -1,4 +1,5 @@ export LOCATION=eastus export ARO_IMAGE=arointsvc.azurecr.io/aro:latest +export NO_CACHE=false . secrets/env