File: Dockerfile.rpmbuild

package info (click to toggle)
weakforced 3.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,196 kB
  • sloc: cpp: 20,397; python: 2,002; sh: 700; makefile: 432
file content (115 lines) | stat: -rw-r--r-- 4,492 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
FROM dist-base as package-builder-base
RUN yum install -y rpm-build rpmdevtools python3-rpm-macros wget \
    /usr/bin/python3 /usr/bin/pip3 && \
    yum groupinstall -y "Development Tools"
RUN yum install -y openssl-devel libuuid-devel zlib-devel
RUN rpmdev-setuptree


SHELL ["bash", "--login", "-c"]

ARG CC=clang
ARG CXX=clang++

RUN mkdir /dist /wforce
WORKDIR /wforce

##############################################################################
# Reusable base with extra packages

FROM package-builder-base as package-builder-fat-base

# Some extra dependencies we install early for better docker caching
RUN ulimit -n 2000 && \
    yum install -y autoconf bzip2 bzip2-devel findutils \
	libuuid-devel net-tools openssl-devel pkgconfig readline-devel tar xz-devel openldap-devel cmake

##############################################################################
# Separate build stage for luaenv to speedup builds and improve caching

FROM package-builder-fat-base as luaenv-builder

@IF [ ! -z "$M_all$M_lua" ]
# These are needed for the luaenv build
@INCLUDE ../../luaenv/Dockerfile.paths-include
# Build Lua dist in docker, and later only package it in an RPM spec
# This is easier to debug than build failures in an RPM build and gets cached in a layer
RUN cd /weakforced/luaenv && ./build.sh -p /usr/share/wforce-lua-dist
@ENDIF

##############################################################################
# Separate build stage for wforce static libs to speedup builds and caching

FROM package-builder-fat-base as wforce-static-libs-builder

@IF [ ! -z "$M_all$M_wforce" ]
COPY --from=sdist /sdist /sdist

ARG DROGON_VERSION=v1.9.1

RUN tar xvf /sdist/prometheus-cpp*Source.tar.gz
RUN mv prometheus-cpp*Source prometheus-cpp
RUN cd prometheus-cpp/_build && make clean && make install

RUN wget https://github.com/jbeder/yaml-cpp/archive/0.8.0.tar.gz
RUN tar xvf 0.8.0.tar.gz
RUN cd yaml-cpp* && mkdir build && cd build && cmake --install-prefix=/usr/local .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON && make install

RUN git clone https://github.com/open-source-parsers/jsoncpp
RUN cd jsoncpp && git checkout tags/1.9.4 -b 1.9.4
RUN cd jsoncpp && mkdir _build && cd _build && cmake --install-prefix=/usr/local .. -DBUILD_SHARED_LIBS=OFF && make && make install

RUN git clone https://github.com/drogonframework/drogon.git
RUN cd drogon && git checkout tags/"$DROGON_VERSION" -b "$DROGON_VERSION"
RUN cd drogon && git submodule init && git submodule update && mkdir _build && cd _build && cmake --install-prefix=/usr/local .. -DBUILD_REDIS=OFF -DBUILD_ORM=OFF -DCMAKE_BUILD_TYPE=Release && make && make install

RUN wget https://github.com/maxmind/libmaxminddb/releases/download/1.7.1/libmaxminddb-1.7.1.tar.gz && tar xvf libmaxminddb-1.7.1.tar.gz
RUN cd libmaxminddb-1.7.1 && ./configure --prefix=/usr/local --enable-shared=no && make && make install
@ENDIF

##############################################################################
# Our package-builder target image

FROM package-builder-fat-base as package-builder

ADD builder-support/specs/ /wforce/builder-support/specs/
ADD builder/helpers /wforce/builder/helpers

# Used for -p option to only build specific spec files
ARG BUILDER_PACKAGE_MATCH

ARG BUILDER_VERSION
ARG BUILDER_RELEASE
ARG BUILDER_EPOCH

@IF [ ! -z "$M_all$M_wforce" ]
COPY --from=sdist /sdist /sdist
RUN for file in /sdist/* ; do ln -s $file /root/rpmbuild/SOURCES/ ; done && ls /root/rpmbuild/SOURCES/
COPY --from=wforce-static-libs-builder /usr/local /usr/local
@ENDIF

#
# Lua dist and modules
#
@IF [ ! -z "$M_all$M_lua" ]
# This is packaged and removed in the lua-dist RPM
COPY --from=luaenv-builder /usr/share/wforce-lua-dist /usr/share/wforce-lua-dist
# Build and install Lua dist package
# QA_RPATHS for: ERROR 0001: file '/usr/share/wforce-lua-dist/lib/lua/5.1/system/core.so' contains a standard rpath '/usr/lib64' in [/usr/lib64]
RUN ulimit -n 2000 && QA_RPATHS=1 builder/helpers/build-specs.sh builder-support/specs/wforce-lua-dist.spec
RUN ulimit -n 2000 && yum localinstall -y /root/rpmbuild/RPMS/*/wforce-lua-dist*.rpm
RUN pkg-config --cflags --libs luajit
@ENDIF


@IF [ ! -z "$M_all$M_wforce" ]
RUN yum install -y /usr/bin/python3
RUN builder/helpers/build-specs.sh builder-support/specs/wforce.spec
@ENDIF

# mv across layers with overlay2 is buggy in some kernel versions (results in empty dirs)
# See: https://github.com/moby/moby/issues/33733
#RUN mv /root/rpmbuild/RPMS/* /dist/
RUN cp -R /root/rpmbuild/RPMS/* /dist/