Skip to content

Commit bf9e93f

Browse files
author
Maria Soto
authored
Merge pull request #6 from bandsintown/cassandra
Base image with PHP-FPM 5.6 and Cassandra Driver and PDO
2 parents 0fc9f1c + 89221b2 commit bf9e93f

4 files changed

Lines changed: 208 additions & 0 deletions

File tree

APKBUILD-php5-pdo_cassandra

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Maintainer: Sébastien RAULT <sebastien@kveer.fr>
2+
pkgname=php5-pdo_cassandra
3+
pkgver=0.6.0
4+
pkgrel=0
5+
pkgdesc="A totally obsolete, but the only one PDO Cassandra driver for cassandra protocol 2.0 only"
6+
url="https://github.com/Orange-OpenSource/YACassandraPDO"
7+
arch="all"
8+
license="GPLv2+"
9+
depends="php5 php5-pdo boost"
10+
depends_dev=""
11+
makedepends="$depends_dev boost-dev"
12+
install=""
13+
subpackages=""
14+
source="$pkgname-$pkgver.tar.gz::https://github.com/Orange-OpenSource/YACassandraPDO/archive/0.6.0.tar.gz"
15+
disturl="dev.alpinelinux.org:/archive/$pkgname/"
16+
giturl=https://github.com/Orange-OpenSource/YACassandraPDO.git
17+
options="!check !fhs"
18+
19+
_builddir="$srcdir"/YACassandraPDO-$pkgver
20+
snapshot() {
21+
local _format="tar.gz"
22+
mkdir -p "$srcdir" && cd "$srcdir"
23+
# clone git repo and archive
24+
local _tag=$pkgver
25+
msg "Creating git snapshot: $pkgname-$pkgver"
26+
git clone --branch $_tag --depth=1 \
27+
--base $giturl ${pkgname}.git || return 1
28+
git --git-dir ${pkgname}.git archive \
29+
--format=$_format \
30+
-o $pkgname-$pkgver.$_format \
31+
--prefix=$pkgname-$pkgver/ $_tag \
32+
|| return 1
33+
# upload to defined distfiles url
34+
scp $pkgname-$pkgver.$_format $disturl || return 1
35+
}
36+
37+
build() {
38+
cd "$_builddir"
39+
phpize || return 1
40+
./configure \
41+
--build=$CBUILD \
42+
--host=$CHOST \
43+
--prefix=/usr \
44+
|| return 1
45+
sed -ie 's!^\(prefix = \).*!\1/usr!g' Makefile || return 1
46+
find . -type f -name "*.cpp" -exec sed -i -e 's/[^:]\(apache::thrift::\)/::\1/g' \
47+
{\} \; \
48+
|| return 1
49+
make || return 1
50+
}
51+
52+
package() {
53+
cd "$_builddir"
54+
make install INSTALL_ROOT="$pkgdir" || return 1
55+
#mkdir -p "$pkgdir"/usr/include
56+
}
57+
sha512sums="05093288e5b35287f464033ddf1cdb2f7283d1c36b0e44407bebb21d57b7da46cc526e63ea6bf15a76c7179a8745f02c7c71ddc3da63faa0fbe965749c9de48f php5-pdo_cassandra-0.6.0.tar.gz"

APKBUILD-thrift

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Maintainer: Sébastien RAULT <sebastien@kveer.fr>
2+
pkgname=thrift
3+
pkgver=0.10.0
4+
pkgrel=3
5+
pkgdesc="Apache Thrift compiler"
6+
url="https://git-wip-us.apache.org/repos/asf/thrift.git"
7+
arch="all"
8+
license="ASL 2.0"
9+
depends="boost glib gobject-introspection libevent openssl zlib"
10+
depends_dev="boost-dev gobject-introspection-dev libevent-dev openssl-dev zlib-dev"
11+
makedepends="$depends_dev glib-dev bison flex"
12+
install=""
13+
subpackages="$pkgname-dev $pkgname-libs"
14+
source="http://www-eu.apache.org/dist/thrift/0.10.0/thrift-0.10.0.tar.gz"
15+
disturl="dev.alpinelinux.org:/archive/$pkgname/"
16+
giturl=https://git-wip-us.apache.org/repos/asf/thrift.git
17+
options="!check !fhs"
18+
19+
_builddir="$srcdir"/thrift-$pkgver
20+
snapshot() {
21+
local _format="tar.gz"
22+
mkdir -p "$srcdir" && cd "$srcdir"
23+
# clone git repo and archive
24+
local _tag=$pkgver
25+
msg "Creating git snapshot: $pkgname-$pkgver"
26+
git clone --branch $_tag --depth=1 \
27+
--base $giturl ${pkgname}.git || return 1
28+
git --git-dir ${pkgname}.git archive \
29+
--format=$_format \
30+
-o $pkgname-$pkgver.$_format \
31+
--prefix=$pkgname-$pkgver/ $_tag \
32+
|| return 1
33+
# upload to defined distfiles url
34+
scp $pkgname-$pkgver.$_format $disturl || return 1
35+
}
36+
37+
build() {
38+
cd "$_builddir/lib/php/src/ext/thrift_protocol"
39+
phpize
40+
41+
cd "$_builddir"
42+
./configure \
43+
--build=$CBUILD \
44+
--host=$CHOST \
45+
--prefix=/usr \
46+
--without-pythonmake \
47+
--enable-tutorial=no \
48+
--with-boost \
49+
--with-c_glib \
50+
--with-cpp \
51+
--with-libevent \
52+
--with-zlib \
53+
--with-php \
54+
--with-php_extension \
55+
--with-qt4=no \
56+
--with-qt5=no \
57+
--with-csharp=no \
58+
--with-erlang=no \
59+
--with-nodejs=no \
60+
--with-lua=no \
61+
--with-python=no \
62+
--with-perl=no \
63+
--with-dart=no \
64+
--with-ruby=no \
65+
--with-haskell=no \
66+
--with-go=no \
67+
--with-haxe=no \
68+
--with-d=no \
69+
|| return 1
70+
make || return 1
71+
}
72+
73+
package() {
74+
cd "$_builddir"
75+
make install DESTDIR="$pkgdir" || return 1
76+
}
77+
sha512sums="3695cf0fb0e4080b02446ab694fb61476997d8b181942dd6fe1e3e7cf0dcf990b4184ea33f9d0bc290b96200f702cf1ac1579e36b6b5bfe9ba8914b2d2938ddc thrift-0.10.0.tar.gz"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
FROM bandsintown/php:5.6-fpm as builder
2+
3+
RUN echo http://dl-cdn.alpinelinux.org/alpine/v3.6/main >> /etc/apk/repositories \
4+
&& echo http://dl-cdn.alpinelinux.org/alpine/v3.6/community >> /etc/apk/repositories
5+
6+
RUN apk update --no-cache && \
7+
apk upgrade --no-cache && \
8+
apk add sudo abuild --virtual .build-deps
9+
10+
# compile cassandra
11+
# the cassandra pecl v1.3.0+ needs cassandra-cpp-driver 1.7+
12+
RUN apk add --no-cache cassandra-cpp-driver libuv gmp && \
13+
apk add --no-cache cassandra-cpp-driver-dev gmp-dev --virtual .build-sec && \
14+
pecl install cassandra-1.3.0 && \
15+
apk del .build-sec
16+
# disable by default
17+
#echo "extension=cassandra.so" > /etc/php5/conf.d/cassandra.ini
18+
19+
RUN adduser -D build && \
20+
addgroup build abuild && \
21+
sudo -H -u build mkdir /home/build/thrift && \
22+
sudo -H -u build mkdir /home/build/php5-pdo_cassandra && \
23+
sudo -H -u build abuild-keygen -an && \
24+
source /home/build/.abuild/abuild.conf && \
25+
cp "$PACKAGER_PRIVKEY".pub /etc/apk/keys/
26+
27+
# compile thrift
28+
COPY APKBUILD-thrift /home/build/thrift/APKBUILD
29+
RUN cd /home/build/thrift && \
30+
sudo -H -u build abuild -r && \
31+
apk add --no-cache /home/build/packages/build/x86_64/thrift*.apk && \
32+
echo "extension=thrift_protocol.so" > /usr/local/etc/php/conf.d/thrift_protocol.ini
33+
34+
# compile php5-pdo_cassandra
35+
COPY APKBUILD-php5-pdo_cassandra /home/build/php5-pdo_cassandra/APKBUILD
36+
RUN cd /home/build/php5-pdo_cassandra && \
37+
sudo -H -u build abuild -r && \
38+
apk add /home/build/packages/build/x86_64/php5-pdo_cassandra-0.6.0-r0.apk && \
39+
echo "extension=pdo_cassandra.so" > /usr/local/etc/php/conf.d/pdo_cassandra.ini
40+
41+
# cleaning
42+
RUN deluser build && \
43+
rm -R /home/build && \
44+
apk del .build-deps
45+
46+
FROM bandsintown/php:5.6-fpm
47+
48+
COPY --from=builder /usr/local/etc/php/conf.d/*.ini /usr/local/etc/php/conf.d/
49+
COPY --from=builder /usr/bin/thrift /usr/bin/thrift
50+
COPY --from=builder /usr/include/thrift /usr/include/thrift
51+
COPY --from=builder /usr/local/lib/php/extensions /usr/local/lib/php/extensions
52+
COPY --from=builder /lib/libcrypto* /lib/
53+
COPY --from=builder /usr/lib/libcrypto* /usr/lib/
54+
COPY --from=builder /usr/lib/libcassandra* /usr/lib/
55+
COPY --from=builder /usr/lib/libthrift* /usr/lib/
56+
COPY --from=builder /usr/lib/libboost* /usr/lib/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM bandsintown/php:5.6-fpm
2+
3+
ENV BATS_VERSION=0.4.0 DOCKERIZE_VERSION=v0.2.0
4+
5+
COPY tests /tests
6+
WORKDIR /tests
7+
8+
RUN exec 2>&1 && apk add --update bind-tools bc jq \
9+
&& curl -Ls https://codeload.github.com/sstephenson/bats/zip/v$BATS_VERSION -o /tmp/bats.zip \
10+
&& cd /tmp \
11+
&& unzip -q bats.zip \
12+
&& ./bats-${BATS_VERSION}/install.sh /usr/local \
13+
&& ln -sf /usr/local/libexec/bats /usr/local/bin/bats \
14+
&& wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
15+
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
16+
&& rm -f bats.zip dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
17+
18+
CMD ["bash"]

0 commit comments

Comments
 (0)