-
Notifications
You must be signed in to change notification settings - Fork 55
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
support using local image tarballs with FROM #52
Conversation
This adds 'image args', configurable with IMAGE_ARG_* - similar to BUILD_ARG_*, only the value points to an image tarball. The image tarball will be loaded and served by a local registry, and a reference to the image in the local registry will be provided as the build arg. To use this, you must modify your Dockerfile like so: ARG base_image=ubuntu FROM ${base_image} Then, when running oci-build-task, specify: params: IMAGE_ARG_base_image: ubuntu/image.tar This will remain forward compatible if we ever switch to Kaniko (#46), which would also require using build args as Kaniko image caching requires a full digest to be specified in FROM. fixes #1 closes #2 closes #3 closes #14 Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
just FYI: seeing issues with this, reproducible in a local test but haven't found the root cause yet. building works fine but the resulting image seems corrupt in some way (fails with |
fixed in f4c893c |
For those who end up here, there are some gotchas to the solution above:
Example pipeline
|
This commit updates the `build-images` pipeline to specify the `govuk-ruby-2.7.X` image as the base image for building app images. There are a [number of different ways to do this](concourse/oci-build-task#14) but this commit uses makes use of the [`IMAGE_ARG_*` param as part of the `vito/oci-build-task` resource](concourse/oci-build-task#52) which allows us to use image resources already defined in the pipeline within our Dockerfiles, where the base image is served from a registry local to the pipeline. It does this by bringing in these images as resources, namespaced under separate ECR repositories, then passing in the appropriate image to the build process via the `IMAGE_ARG_base_image` param (reflected in app `Dockerfile`s); the `FROM` command in said `Dockerfile`s then point to the correct ECR repository for the `govuk-ruby-2.7.X` base image (rather than to Docker Hub).
This commit updates the `build-images` pipeline to specify the `govuk-ruby-2.7.X` image as the base image for building app images. There are a [number of different ways to do this](concourse/oci-build-task#14) but this commit uses makes use of the [`IMAGE_ARG_*` param as part of the `vito/oci-build-task` resource](concourse/oci-build-task#52) which allows us to use image resources already defined in the pipeline within our Dockerfiles, where the base image is served from a registry local to the pipeline. It does this by bringing in these images as resources, namespaced under separate ECR repositories, then passing in the appropriate image to the build process via the `IMAGE_ARG_base_image` param (reflected in app `Dockerfile`s); the `FROM` command in said `Dockerfile`s then point to the correct ECR repository for the `govuk-ruby-2.7.X` base image (rather than to Docker Hub).
This commit updates the `build-images` pipeline to specify the `govuk-ruby-2.7.X` image as the base image for building app images. There are a [number of different ways to do this](concourse/oci-build-task#14) but this commit uses makes use of the [`IMAGE_ARG_*` param as part of the `vito/oci-build-task` resource](concourse/oci-build-task#52) which allows us to use image resources already defined in the pipeline within our Dockerfiles, where the base image is served from a registry local to the pipeline. It does this by bringing in these images as resources, namespaced under separate ECR repositories, then passing in the appropriate image to the build process via the `IMAGE_ARG_base_image` param (reflected in app `Dockerfile`s); the `FROM` command in said `Dockerfile`s then point to the correct ECR repository for the `govuk-ruby-2.7.X` base image (rather than to Docker Hub).
This commit updates the `build-images` pipeline to specify the `govuk-ruby-2.7.X` image as the base image for building app images. There are a [number of different ways to do this](concourse/oci-build-task#14) but this commit uses makes use of the [`IMAGE_ARG_*` param as part of the `vito/oci-build-task` resource](concourse/oci-build-task#52) which allows us to use image resources already defined in the pipeline within our Dockerfiles, where the base image is served from a registry local to the pipeline. It does this by bringing in these images as resources, namespaced under separate ECR repositories, then passing in the appropriate image to the build process via the `IMAGE_ARG_base_image` param (reflected in app `Dockerfile`s); the `FROM` command in said `Dockerfile`s then point to the correct ECR repository for the `govuk-ruby-2.7.X` base image (rather than to Docker Hub).
This adds 'image args', configurable with IMAGE_ARG_* - similar to BUILD_ARG_*, only the value points to an image tarball.
The image tarball will be loaded and served by a local registry, and a reference to the image in the local registry will be provided as the build arg.
To use this, you must modify your Dockerfile like so:
Then, when running
oci-build-task
, specify:This will remain forward compatible if we ever switch to Kaniko (#46), which would also require using build args as Kaniko image caching requires a full digest to be specified in FROM.
fixes #1
closes #2
closes #3
closes #14