%global provider github %global provider_tld com %global project openshift %global repo imagebuilder # https://github.com/openshift/imagebuilder %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} %global commit c3e2e96f351aa1b355fb90169ec9390b7eff5fc5 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global debug_package %{nil} Name: imagebuilder Version: 0.0.1 Release: 1%{?dist} Summary: Builds Dockerfile using the Docker client (with squashing! and secrets!) License: ASL 2.0 URL: https://%{provider_prefix} Source: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} BuildRequires: golang(github.com/opencontainers/runc/libcontainer/system) # pull in golang libraries by explicit import path, inside the meta golang() %description This library supports using the Dockerfile syntax to build Docker compatible images, without invoking Docker build. It is intended to give clients more control over how a Docker build is run, including: Instead of building one layer per line, run all instructions in the same container Set Docker HostConfig settings like network and memory controls that are not available when running Docker builds Mount external files into the build that are not persisted as part of the final image (i.e. "secrets") If there are no RUN commands in the Dockerfile, the container is created and committed, but never started. %prep %setup -q -n %{repo}-%{commit} %build mkdir _build pushd _build mkdir -p src/%{provider}.%{provider_tld}/%{project} ln -s $(dirs +1 -l) src/%{import_path} popd mv vendor src export GOPATH=$(pwd)/_build:$(pwd):%{gopath} go build -o bin/imagebuilder . %install install -d %{buildroot}%{_bindir} install -p -m 0755 bin/imagebuilder %{buildroot}%{_bindir}/imagebuilder %files %defattr(-,root,root,-) %license LICENSE %doc README.md %{_bindir}/%{name} %changelog * Mon Jun 26 2017 Vadim Rutkovsky - 0.0.1-1 - package the imagebuilder