This commit is contained in:
Denis Zheleztsov 2016-11-16 10:08:39 +03:00
parent ed2fffefeb
commit 5cd3f7c9b8
4 changed files with 75 additions and 8 deletions

View File

@ -14,6 +14,7 @@ before_install:
- ./build.sh alpine
- ./build.sh centos
- ./build.sh centos_rpm
- ./build.sh fedora_rpm
script:
- ./runtests.sh

View File

@ -5,7 +5,7 @@ set -e
. functions.sh
function usage() {
echo "$0 <clean|build_package|surok_image|alpine|centos|centos_rpm>"
echo "$0 <clean|build_package|surok_image|alpine|centos|centos_rpm|fedora_rpm>"
}
case $1 in
@ -14,11 +14,12 @@ case $1 in
build_builder
build_package
;;
build_deb) build_package ;;
build_deb) build_package ;;
surok_image) build_surok_base rebuild ;;
surok_image_no_rebuild) build_surok_base ;;
alpine) build_alpine ;;
centos) build_centos ;;
centos_rpm) build_centos_rpm ;;
fedora_rpm) build_fedora_rpm ;;
*) usage ;;
esac

View File

@ -136,9 +136,6 @@ MAINTAINER Denis Zheleztsov <difrex.punk@gmail.com>
RUN yum -y install rpm-build
COPY surok /tmp/surok-${VERSION}
RUN find /tmp/surok-${VERSION} -name '*pyc' -delete
RUN find /tmp/surok-${VERSION} -name '*pyo' -delete
RUN rm -rf /tmp/surok-${VERSION}/surok/__pycache__
RUN mkdir -p /root/rpmbuild/SPECS
RUN mkdir -p /root/rpmbuild/SOURCES
RUN cd /tmp && tar -czvf /root/rpmbuild/SOURCES/surok.tar.gz surok-${VERSION}
@ -152,20 +149,33 @@ EOF
}
function fedora_builder() {
cat > Dockerfile.fedora_builder <<EOF
copy_surok
VERSION=$(grep 'Version: ' surok/surok_fedora.spec | awk -F': ' '{print $2}')
cat > Dockerfile.centos_builder <<EOF
FROM fedora:24
MAINTAINER Denis Zheleztsov <difrex.punk@gmail.com>
RUN dnf -y install rpm-build
COPY surok /root/rpmbuild/SOURCES/surok
COPY surok /tmp/surok-${VERSION}
RUN mkdir -p /root/rpmbuild/SPECS
RUN mkdir -p /root/rpmbuild/SOURCES
RUN cd /tmp && tar -czvf /root/rpmbuild/SOURCES/surok.tar.gz surok-${VERSION}
ADD surok/surok_fedora.spec /root/rpmbuild/SPECS/
RUN dnf clean all
ENTRYPOINT cd /root/rpmbuild/SPECS && rpmbuild -bb surok_fedora.spec
EOF
docker build -t surok_builder_fedora -f Dockerfile.fedora_builder .
docker build -t surok_builder_fedora -f Dockerfile.centos_builder .
}
function build_centos_rpm() {
centos_builder
docker run -v $(pwd)/out:/root/rpmbuild/RPMS -ti surok_builder_centos
}
function build_fedora_rpm() {
fedora_builder
docker run -v $(pwd)/out:/root/rpmbuild/RPMS -ti surok_builder_fedora
}

55
surok_fedora.spec Normal file
View File

@ -0,0 +1,55 @@
Summary: Simple service discovery for Apache Mesos clusters
Name: surok
Version: 0.7.4.1
Release: 1.fc24
License: BSD
Group: admin
URL: https://github.com/Difrex/surok
Source0: surok.tar.gz
BuildArch: noarch
Requires: python3-requests, python3-dns, python3-memcached, python3-jinja2
# BuildRoot: %{_tmppath}/%{name}-%{release}-root
%description
Simple service discovery for Apache Mesos clusters
%prep
%setup -q
%build
%install
mkdir -p %{buildroot}/opt/surok/surok
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/__init__.py %{buildroot}/opt/surok/surok
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/logger.py %{buildroot}/opt/surok/surok
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/system.py %{buildroot}/opt/surok/surok
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/discovery.py %{buildroot}/opt/surok/surok
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/templates.py %{buildroot}/opt/surok/surok
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok.py %{buildroot}/opt/surok
mkdir -p %{buildroot}/etc/surok/{conf,conf.d,templates}
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/conf/surok.json %{buildroot}/etc/surok/conf
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/conf.d/selfcheck.json %{buildroot}/etc/surok/conf.d
install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/templates/selfcheck.jj2 %{buildroot}/etc/surok/templates
%clean
rm -rf $RPM_BUILD_ROOT
%files
/opt/surok/surok/__init__.py
/opt/surok/surok/logger.py
/etc/surok/conf/surok.json
/opt/surok/surok.py
/opt/surok/surok/discovery.py
/opt/surok/surok/system.py
/opt/surok/surok/templates.py
/etc/surok/conf.d/selfcheck.json
/etc/surok/templates/selfcheck.jj2
%defattr(-,root,root,-)
%doc
%changelog
* Mon Nov 14 2016 Denis Zheleztsov <difrex.punk@gmail.com> -
- Initial build.