Skip to content

Use named context for check_standalong_config.sh #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qswinson
Copy link

@qswinson qswinson commented Jun 4, 2025

This commit added a step to the build process to copy the utils/check_standalone_config.sh file into the targeted Docker project before being able to build the image. This is a well-meaning approach to reduce code duplication and ease maintenance. However, the problem with this approach is that it breaks the ability to use this repo as a remote Docker context as the Dockerfiles now include a COPY command for a file that does not exist in GitHub.
The better way to handle this is to use named context to source the file from ./utils. This PR updates the Dockerfile definitions and the Makefile build steps.
With this change, anyone can now build images from my branch like this:

docker build -t apisix --build-context utils=https://github.com/qswinson/apisix-docker.git#docker-named-context:utils https://github.com/qswinson/apisix-docker.git#docker-named-context:debian

You can also define a Docker Bake file in your own repo to customize the final APISIX image. Name the file with the contents belowdocker-bake.hcl and build it with this command: docker buildx bake apisix.

target base {
  context = "https://github.com/qswinson/apisix-docker.git#docker-named-context:debian"
  contexts = {
    "utils" = "https://github.com/qswinson/apisix-docker.git#docker-named-context:utils"
  }
  platforms = [
    "linux/amd64"
  ]
}

target apisix {
  contexts = {
    baseapisix = "target:base"
  }
  dockerfile = "Dockerfile"
  tags = ["apisix:latest"]
  platforms = [
    "linux/x86_64"
  ]
}

Being able to build images on demand is very important for addressing security vulnerabilities that are resolved in the base debian/redhat image.

Copy link

github-actions bot commented Aug 4, 2025

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time ordiscuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant