Skip to content

Commit

Permalink
Merge pull request #53 from jlamoree/feature-docker-args
Browse files Browse the repository at this point in the history
Supports passing args to Docker builders
  • Loading branch information
DBezemer authored Dec 2, 2022
2 parents c045311 + e0d1ca6 commit e95c48d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ SOURCES/haproxy-*.tar.gz
rpmbuild
RPMS
lua-*
.docker
2 changes: 1 addition & 1 deletion Dockerfile-amzn2
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ COPY Makefile Makefile
COPY SPECS/haproxy.spec SPECS/haproxy.spec
COPY SOURCES/* SOURCES/

CMD make NO_SUDO=1 && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS
CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS
2 changes: 1 addition & 1 deletion Dockerfile7
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ COPY Makefile Makefile
COPY SPECS/haproxy.spec SPECS/haproxy.spec
COPY SOURCES/* SOURCES/

CMD make NO_SUDO=1 && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS
CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS
2 changes: 1 addition & 1 deletion Dockerfile8
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ COPY Makefile Makefile
COPY SPECS/haproxy.spec SPECS/haproxy.spec
COPY SOURCES/* SOURCES/

CMD make NO_SUDO=1 && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS
CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ build-docker:
run-docker: build-docker
mkdir -p RPMS
chcon -Rt svirt_sandbox_file_t RPMS || true
docker run --volume $(HOME)/RPMS:/RPMS --rm haproxy-rpm-builder7:${VERSION}-${RELEASE}
docker run --volume $(HOME)/RPMS:/RPMS --rm haproxy-rpm-builder8:${VERSION}-${RELEASE}
docker run --volume $(HOME)/RPMS:/RPMS --rm haproxy-rpm-builder-amzn2:${VERSION}-${RELEASE}
docker run --volume $(HOME)/RPMS:/RPMS --rm -e USE_PROMETHEUS=${USE_PROMETHEUS} -e RELEASE=${RELEASE} haproxy-rpm-builder7:${VERSION}-${RELEASE}
docker run --volume $(HOME)/RPMS:/RPMS --rm -e USE_PROMETHEUS=${USE_PROMETHEUS} -e RELEASE=${RELEASE} haproxy-rpm-builder8:${VERSION}-${RELEASE}
docker run --volume $(HOME)/RPMS:/RPMS --rm -e USE_PROMETHEUS=${USE_PROMETHEUS} -e RELEASE=${RELEASE} haproxy-rpm-builder-amzn2:${VERSION}-${RELEASE}

build: $(build_stages)
cp -r ./SPECS/* ./rpmbuild/SPECS/ || true
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ Resulting RPMs will be in `/opt/rpm-haproxy/rpmbuild/RPMS/x86_64/`

## Build using Docker
make run-docker

Resulting RPMs will be in `./RPMS/`
When updating any of the files that are included in the build phase, ensure that you also bump the release number

Resulting RPMs will be in `./RPMS/`
When updating any of the files that are included in the build phase, ensure that you also bump the release number, like so:
make USE_PROMETHEUS=1 RELEASE=3 run-docker

## Credits

Expand Down
4 changes: 2 additions & 2 deletions SPECS/haproxy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ USE_LUA="USE_LUA=1"
%endif

%if 0%{_use_prometheus}
USE_PROMETHEUS="USE_PROMEX=1"
USE_PROMEX="USE_PROMEX=1"
%endif

%if "%{_extra_cflags}" != "0"
CFLAGS="$CFLAGS %{_extra_cflags}"
%endif

%{__make} -j$RPM_BUILD_NCPUS %{?_smp_mflags} ${USE_LUA} CPU="generic" TARGET="linux-glibc" ${systemd_opts} ${pcre_opts} USE_OPENSSL=1 USE_ZLIB=1 ${regparm_opts} ADDINC="$CFLAGS" USE_LINUX_TPROXY=1 USE_THREAD=1 USE_TFO=${USE_TFO} USE_NS=${USE_NS} ${USE_PROMETHEUS} ADDLIB="%{__global_ldflags}"
%{__make} -j$RPM_BUILD_NCPUS %{?_smp_mflags} ${USE_LUA} CPU="generic" TARGET="linux-glibc" ${systemd_opts} ${pcre_opts} USE_OPENSSL=1 USE_ZLIB=1 ${regparm_opts} ADDINC="$CFLAGS" USE_LINUX_TPROXY=1 USE_THREAD=1 USE_TFO=${USE_TFO} USE_NS=${USE_NS} ${USE_PROMEX} ADDLIB="%{__global_ldflags}"

%{__make} admin/halog/halog OPTIMIZE="%{optflags} %{__global_ldflags}"

Expand Down

0 comments on commit e95c48d

Please sign in to comment.