From 3cd0409184cb12892c1c7cdee5f64edeb070b02b Mon Sep 17 00:00:00 2001 From: Matt Hook Date: Thu, 1 Jun 2023 13:50:34 +1200 Subject: [PATCH] fix(build) cleanup build process [EE-5555] (#9026) * improve makefile and related files * update wording for build-all target --- .github/workflows/pr-security.yml | 6 +++--- CONTRIBUTING.md | 2 +- Makefile | 14 +++++++------- dev/run_container.sh | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr-security.yml b/.github/workflows/pr-security.yml index 35467c009..efb803381 100644 --- a/.github/workflows/pr-security.yml +++ b/.github/workflows/pr-security.yml @@ -13,7 +13,7 @@ on: - 'build/linux/alpine.Dockerfile' - 'build/windows/Dockerfile' - '.github/workflows/pr-security.yml' - + jobs: client-dependencies: name: Client Dependency Check @@ -24,7 +24,7 @@ jobs: outputs: jsdiff: ${{ steps.set-diff-matrix.outputs.js_diff_result }} steps: - - name: checkout repository + - name: checkout repository uses: actions/checkout@master - name: scan vulnerabilities by Snyk @@ -157,7 +157,7 @@ jobs: run: yarn --frozen-lockfile - name: build - run: make build + run: make build-all - name: set up docker buildx uses: docker/setup-buildx-action@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03eab3ee5..81dce5477 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,7 +96,7 @@ Portainer server can now be accessed at . and UI dev ser if you want to build the project you can run: ```sh -make build +make build-all ``` For additional make commands, run `make help`. diff --git a/Makefile b/Makefile index d087d8745..7c430f161 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ GOTESTSUM=go run gotest.tools/gotestsum@latest init-dist: @mkdir -p dist -build: build-server build-client ## Build the server and client +build-all: deps build-server build-client ## Build the client, server and download external dependancies (doesn't build an image) build-client: init-dist ## Build the client export NODE_ENV=$(ENV) && yarn build --config $(WEBPACK_CONFIG) @@ -29,21 +29,21 @@ build-client: init-dist ## Build the client build-server: init-dist ## Build the server binary ./build/build_binary.sh "$(PLATFORM)" "$(ARCH)" -build-image: build ## Build the Portainer image locally +build-image: build-all ## Build the Portainer image locally docker buildx build --load -t portainerci/portainer:$(TAG) -f build/linux/Dockerfile . -devops: clean init-dist deps build-client ## Build the server binary for CI +build-storybook: ## Build and serve the storybook files + yarn storybook:build + +devops: clean deps build-client ## Build the everything target specifically for CI echo "Building the devops binary..." @./build/build_binary_azuredevops.sh "$(PLATFORM)" "$(ARCH)" -build-storybook: - yarn storybook:build - ##@ Build dependencies .PHONY: deps server-deps client-deps tidy deps: server-deps client-deps ## Download all client and server build dependancies -server-deps: ## Download dependant server binaries +server-deps: init-dist ## Download dependant server binaries @./build/download_binaries.sh $(PLATFORM) $(ARCH) client-deps: ## Install client dependencies diff --git a/dev/run_container.sh b/dev/run_container.sh index da69e0abc..09990897e 100755 --- a/dev/run_container.sh +++ b/dev/run_container.sh @@ -17,5 +17,6 @@ docker run -d \ -v /var/run/docker.sock:/var/run/alternative.sock:z \ -v /tmp:/tmp \ --name portainer \ +--rm \ portainer/base \ /app/portainer ${PORTAINER_FLAGS}