{"id":18637173,"url":"https://github.com/openshift/imagebuilder","last_synced_at":"2025-05-14T23:07:44.403Z","repository":{"id":10036386,"uuid":"63968727","full_name":"openshift/imagebuilder","owner":"openshift","description":"Builds Dockerfile using the Docker client (with squashing! and secrets!)","archived":false,"fork":false,"pushed_at":"2025-05-12T14:28:44.000Z","size":15049,"stargazers_count":129,"open_issues_count":2,"forks_count":69,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-12T15:49:37.154Z","etag":null,"topics":["docker","docker-builder","dockerfile"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openshift.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-22T16:44:27.000Z","updated_at":"2025-05-12T14:28:48.000Z","dependencies_parsed_at":"2023-11-07T17:48:42.044Z","dependency_job_id":"fe3d92f5-46cc-4d55-92e9-9bc807c7ca9c","html_url":"https://github.com/openshift/imagebuilder","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fimagebuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fimagebuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fimagebuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fimagebuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openshift","download_url":"https://codeload.github.com/openshift/imagebuilder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243362,"owners_count":22038046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-builder","dockerfile"],"created_at":"2024-11-07T05:33:54.133Z","updated_at":"2025-05-14T23:07:39.395Z","avatar_url":"https://github.com/openshift.png","language":"Go","readme":"OCI Image Builder\n==========================\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/openshift/imagebuilder)](https://goreportcard.com/report/github.com/openshift/imagebuilder)\n[![GoDoc](https://godoc.org/github.com/openshift/imagebuilder?status.png)](https://godoc.org/github.com/openshift/imagebuilder)\n[![Travis](https://app.travis-ci.com/openshift/imagebuilder.svg?branch=master)](https://app.travis-ci.com/github/openshift/imagebuilder)\n[![Join the chat at freenode:openshift-dev](https://img.shields.io/badge/irc-freenode%3A%20%23openshift--dev-blue.svg)](http://webchat.freenode.net/?channels=%23openshift-dev)\n\nPlease test your images (and add to our conformance suite)!\n\nThis library supports using the Dockerfile syntax to build OCI \u0026 Docker\ncompatible images, without invoking a container build command such as `buildah bud` or `docker build`. It is intended to give\nclients more control over how they build container images, including:\n\n* Instead of building one layer per line, run all instructions in the\n  same container\n* Set HostConfig settings like network and memory controls that\n  are not available when running container builds\n* Mount external files into the build that are not persisted as part of\n  the final image (i.e. \"secrets\")\n* If there are no RUN commands in the Dockerfile, the container is created\n  and committed, but never started.\n\nThe final image should be 99.9% compatible with regular container builds,\nbut bugs are always possible.\n\nFuture goals include:\n\n* Output OCI compatible images\n* Support other container execution engines, like runc or rkt\n* Better conformance testing\n* Windows support\n\n## Install and Run\n\nTo download and install the library and the binary, set up a Golang build environment and with `GOPATH` set run:\n\n```\n$ go install github.com/openshift/imagebuilder/cmd/imagebuilder@latest\n```\n\nThe included command line takes one argument, a path to a directory containing a Dockerfile. The `-t` option\ncan be used to specify an image to tag as:\n\n```\n$ imagebuilder [-t TAG] DIRECTORY\n```\n\nTo mount a file into the image for build that will not be present in the final output image, run:\n\n```\n$ imagebuilder --mount ~/secrets/private.key:/etc/keys/private.key path/to/my/code testimage\n```\n\nAny processes in the Dockerfile will have access to `/etc/keys/private.key`, but that file will not be part of the committed image.\n\nYou can also customize which Dockerfile is run, or run multiple Dockerfiles in sequence (the FROM is ignored on\nlater files):\n\n```\n$ imagebuilder -f Dockerfile:Dockerfile.extra .\n```\n\nwill build the current directory and combine the first Dockerfile with the second. The FROM in the second image\nis ignored.\n\nNote that imagebuilder adds the built image to the `docker` daemon's internal storage. If you use `podman` you must first pull the image into its local registry:\n\n```\n$ podman pull docker-daemon:\u003cIMAGE\u003e:\u003cTAG\u003e # must contain either a tag or a digest\n```\n\n## Code Example\n\n```go\nf, err := os.Open(\"path/to/Dockerfile\")\nif err != nil {\n\treturn err\n}\ndefer f.Close()\n\ne := builder.NewClientExecutor(o.Client)\ne.Out, e.ErrOut = os.Stdout, os.Stderr\ne.AllowPull = true\ne.Directory = \"context/directory\"\ne.Tag = \"name/of-image:and-tag\"\ne.AuthFn = nil // ... pass a function to retrieve authorization info\ne.LogFn = func(format string, args ...interface{}) {\n\tfmt.Fprintf(e.ErrOut, \"--\u003e %s\\n\", fmt.Sprintf(format, args...))\n}\n\nbuildErr := e.Build(f, map[string]string{\"arg1\":\"value1\"})\nif err := e.Cleanup(); err != nil {\n\tfmt.Fprintf(e.ErrOut, \"error: Unable to clean up build: %v\\n\", err)\n}\n\nreturn buildErr\n```\n\nExample of usage from OpenShift's experimental `dockerbuild` [command with mount secrets](https://github.com/openshift/origin/blob/26c9e032ff42f613fe10649cd7c5fa1b4c33501b/pkg/cmd/cli/cmd/dockerbuild/dockerbuild.go)\n\n## Run conformance tests (very slow):\n\n```\ndocker rmi busybox; docker pull busybox\ndocker rmi alpine; docker pull alpine\ndocker rmi centos:7; docker pull centos:7\ndocker rmi registry.fedoraproject.org/fedora-minimal; docker pull registry.fedoraproject.org/fedora-minimal\ndocker rmi registry.fedoraproject.org/fedora-minimal:41-x86_64; docker pull registry.fedoraproject.org/fedora-minimal:41-x86_64\ndocker rmi registry.fedoraproject.org/fedora-minimal:41-aarch64; docker pull registry.fedoraproject.org/fedora-minimal:41-aarch64\nchmod -R go-w ./dockerclient/testdata\ngo test ./dockerclient -tags conformance -timeout 30m\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift%2Fimagebuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenshift%2Fimagebuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift%2Fimagebuilder/lists"}