KNOX-3256: Refactor Docker build to use local Maven artifacts and unify CI/Dev workflows#1239
KNOX-3256: Refactor Docker build to use local Maven artifacts and unify CI/Dev workflows#1239smolnar82 wants to merge 3 commits into
Conversation
…fy CI/Dev workflows
| args: | ||
| knoxurl: ${knoxurl:-https://github.com/apache/knox.git} | ||
| branch: ${branch:-master} | ||
| context: ../../../ |
There was a problem hiding this comment.
Add a .dockerignore at the root that allowlists only what the Dockerfile needs: e.g. * !target//knox-.tar.gz !target//knoxshell-.tar.gz !.github/workflows/build/
The build log shows about 200 MB of artifacts being transferred on every build. Looks like every build sends the full Maven target directory, .git history, docs, and any local credentials to the Docker daemon. This is both slow and a potential (I am not sure yet) secrets leakage.
| - name: Build Docker Images | ||
| run: | | ||
| export knoxurl=${KNOX_URL} | ||
| export branch=${BRANCH:-master} |
There was a problem hiding this comment.
knox-dev service built the official image tagged apache/knox-dev:master. Service now builds an image tagged local-${GITHUB_RUN_ID:-local}-${GITHUB_RUN_ID:-local}. basically, there is no master tag.
This causes two issues, there will be lots of images in the Apache repo which will exhaust our quota, secondly, it is not easy to pickup a knox image will the most latest changes. The idea behind using apache/knox-dev:master was to save space and provide folks with an image with all commits on master.
Test Results21 tests 21 ✅ 1s ⏱️ Results for commit 8f2f248. ♻️ This comment has been updated with latest results. |
|
@moresandeep - I addressed your review comments; please give it another shot. Thanks! |
KNOX-3256 - Refactor Docker build to use local Maven artifacts and unify CI/Dev workflows
What changes were proposed in this pull request?
This PR refactors the Docker build process used in CI and local development to be more efficient and unified. Key changes include:
github/workflows/build/Dockerfileto copy pre-built tarballs directly from the localtarget/directory. This eliminates the need for external staging directories.Dockerfile.localwhich previously cloned the repository and built Knox from scratch inside the container. This was redundant and slow compared to using existing local Maven artifacts.docker-compose.ymlto use the project root as the build context, allowing the Dockerfile to access thetarget/directory directly..github/workflows/tests.ymlby removing manual artifact extraction steps and environment variables that were only needed for the old cloning-based build.How was this patch tested?
Integration Tests
Updated
.github/workflows/tests.ymlto use the new simplified build process. The integration tests themselves remain the same but now run against an image built more reliably from the local build output.UI changes
N/A