Skip to content
Snippets Groups Projects
Commit e31ebfea authored by Seva's avatar Seva
Browse files

docker: finalize restinio conan setup

parent 07efe8c7
No related branches found
No related tags found
No related merge requests found
FROM ubuntu:16.04
MAINTAINER Adrien Béraud <adrien.beraud@savoirfairelinux.com>
RUN apt-get update && apt-get install -y build-essential cmake git wget libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libuv1-dev cython3 python3-dev libcppunit-dev libjsoncpp-dev libasio-dev libssl-dev python3-setuptools python3-pip && apt-get clean
RUN apt-get update && apt-get install -y \
build-essential cmake git wget libncurses5-dev libreadline-dev nettle-dev \
libgnutls28-dev libuv1-dev cython3 python3-dev libcppunit-dev libjsoncpp-dev \
libasio-dev libssl-dev python3-setuptools python3-pip \
&& apt-get clean
#patch for https://github.com/Stiffstream/restinio-conan-example/issues/2
RUN pip3 install --upgrade cmake && cmake --version
RUN pip3 install --upgrade cmake
#install conan & add restinio remotes
RUN pip3 install conan && \
conan remote add stiffstream https://api.bintray.com/conan/stiffstream/public && \
conan remote add public-conan https://api.bintray.com/conan/bincrafters/public-conan
#clone & setup restinio docker project
RUN git clone https://github.com/binarytrails/restinio-conan.git
#setup restinio docker project
RUN mkdir restinio-conan
COPY conan/restinio/conanfile.txt restinio-conan/conanfile.txt
COPY conan/restinio/conanfile.py restinio-conan/conanfile.py
#build restinio from source
RUN echo "*** Building RESTinio ***" \
&& cd restinio-conan \
&& mkdir build \
&& cd build \
&& conan install -o restinio:boost_libs=none --build=missing .. \
&& conan install .. --build=missing
#&& conan package --package-folder /usr .
RUN echo "*** Installing RESTinio & dependencies ***" \
&& cd restinio-conan \
&& conan source . \
&& conan install -o restinio:boost_libs=none --build=missing . \
&& conan package . -pf /usr/local \
&& cd ../ && rm -rf restinio*
#build http_parser fork
RUN echo "*** Building http_parser for custom HTTP methods ***" \
&& git clone https://github.com/eao197/http-parser.git \
......@@ -26,8 +31,8 @@ RUN echo "*** Building http_parser for custom HTTP methods ***" \
#build msgpack from source
RUN wget https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz \
&& tar -xzf msgpack-2.1.5.tar.gz \
&& cd msgpack-2.1.5 && mkdir build && cd build \
&& cmake -DMSGPACK_CXX11=ON -DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j8 && make install \
&& cd ../.. && rm -rf msgpack-2.1.5 msgpack-2.1.5.tar.gz
&& tar -xzf msgpack-2.1.5.tar.gz \
&& cd msgpack-2.1.5 && mkdir build && cd build \
&& cmake -DMSGPACK_CXX11=ON -DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j8 && make install \
&& cd ../.. && rm -rf msgpack-2.1.5 msgpack-2.1.5.tar.gz
FROM ubuntu:16.04
MAINTAINER Adrien Béraud <adrien.beraud@savoirfairelinux.com>
RUN apt-get update \
&& apt-get install -y llvm llvm-dev clang make cmake git wget libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libuv1-dev libmsgpack-dev libjsoncpp-dev libasio-dev cython3 python3-dev python3-setuptools libcppunit-dev python3-pip \
&& apt-get remove -y gcc g++ && apt-get autoremove -y && apt-get clean
&& apt-get install -y llvm llvm-dev clang make cmake git wget libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libuv1-dev libmsgpack-dev libjsoncpp-dev libasio-dev cython3 python3-dev python3-setuptools libcppunit-dev python3-pip \
&& apt-get remove -y gcc g++ && apt-get autoremove -y && apt-get clean
ENV CC cc
ENV CXX c++
#patch for https://github.com/Stiffstream/restinio-conan-example/issues/2
RUN pip3 install --upgrade cmake && cmake --version
RUN pip3 install --upgrade cmake
#install conan & add restinio remotes
RUN pip3 install conan && \
conan remote add stiffstream https://api.bintray.com/conan/stiffstream/public && \
conan remote add public-conan https://api.bintray.com/conan/bincrafters/public-conan
#clone & setup restinio docker project
RUN git clone https://github.com/binarytrails/restinio-conan.git
#setup restinio docker project
RUN mkdir restinio-conan
COPY conan/restinio/conanfile.txt restinio-conan/conanfile.txt
COPY conan/restinio/conanfile.py restinio-conan/conanfile.py
#build restinio from source
RUN echo "*** Building RESTinio ***" \
&& cd restinio-conan \
&& mkdir build \
&& cd build \
&& conan install -o restinio:boost_libs=none --build=missing .. \
&& conan install .. --build=missing
#&& conan package --package-folder /usr .
RUN echo "*** Installing RESTinio & dependencies ***" \
&& cd restinio-conan \
&& conan source . \
&& conan install -o restinio:boost_libs=none --build=missing . \
&& conan package . -pf /usr/local \
&& cd ../ && rm -rf restinio*
#build http_parser fork
RUN echo "*** Building http_parser for custom HTTP methods ***" \
&& git clone https://github.com/eao197/http-parser.git \
......@@ -31,8 +32,8 @@ RUN echo "*** Building http_parser for custom HTTP methods ***" \
#build msgpack from source
RUN wget https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz \
&& tar -xzf msgpack-2.1.5.tar.gz \
&& cd msgpack-2.1.5 && mkdir build && cd build \
&& cmake -DMSGPACK_CXX11=ON -DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j8 && make install \
&& cd ../.. && rm -rf msgpack-2.1.5 msgpack-2.1.5.tar.gz
&& tar -xzf msgpack-2.1.5.tar.gz \
&& cd msgpack-2.1.5 && mkdir build && cd build \
&& cmake -DMSGPACK_CXX11=ON -DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j8 && make install \
&& cd ../.. && rm -rf msgpack-2.1.5 msgpack-2.1.5.tar.gz
from conans import ConanFile, CMake, tools
import os
class SobjectizerConan(ConanFile):
name = "restinio"
version = "0.5.1"
license = "BSD-3-Clause"
url = "https://github.com/Stiffstream/restinio-conan"
description = (
"RESTinio is a header-only C++14 library that gives you "
"an embedded HTTP/Websocket server."
)
settings = "os", "compiler", "build_type", "arch"
options = {'boost_libs': ['none', 'static', 'shared']}
default_options = {'boost_libs': 'none'}
generators = "cmake"
source_subfolder = "restinio"
build_policy = "missing"
def requirements(self):
self.requires.add("http-parser/2.8.1@bincrafters/stable")
self.requires.add("fmt/5.3.0@bincrafters/stable")
if self.options.boost_libs == "none":
self.requires.add("asio/1.12.2@bincrafters/stable")
else:
self.requires.add("boost/1.69.0@conan/stable")
if self.options.boost_libs == "shared":
self.options["boost"].shared = True
else:
self.options["boost"].shared = False
def source(self):
source_url = "https://bitbucket.org/sobjectizerteam/restinio/downloads"
tools.get("{0}/restinio-{1}.zip".format(source_url, self.version))
extracted_dir = "restinio-" + self.version
os.rename(extracted_dir, self.source_subfolder)
def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions['RESTINIO_INSTALL'] = True
cmake.definitions['RESTINIO_FIND_DEPS'] = False
cmake.definitions['RESTINIO_USE_BOOST_ASIO'] = self.options.boost_libs
cmake.configure(source_folder = self.source_subfolder + "/dev/restinio")
return cmake
def package(self):
cmake = self._configure_cmake()
self.output.info(cmake.definitions)
cmake.install()
def package_info(self):
self.info.header_only()
if self.options.boost_libs != "none":
self.cpp_info.defines.append("RESTINIO_USE_BOOST_ASIO")
[requires]
restinio/0.5.1@stiffstream/stable
[generators]
cmake
[options]
[imports]
bin, *.dll -> ./bin # Copies all dll files from packages bin folder to my "bin" folder
lib, *.dylib* -> ./bin # Copies all dylib files from packages lib folder to my "bin" folder
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment