diff --git a/docker-build/Dockerfile-alpine b/docker-build/Dockerfile-alpine new file mode 100644 index 0000000..8a095b4 --- /dev/null +++ b/docker-build/Dockerfile-alpine @@ -0,0 +1,37 @@ +ARG VERSION=latest +FROM alpine:${VERSION} AS build + +# add c build tools +RUN apk add build-base + +# add git +RUN apk add git + +# add php dev +RUN apk add php7-dev + +# add zlib dev +RUN apk add zlib-dev + +# clone php-spx +RUN git clone https://github.com/NoiseByNorthwest/php-spx.git + +# set workdir +WORKDIR /php-spx + +# checkout release +RUN git checkout tags/v0.4.10 + +# build php-spx +RUN phpize +RUN ./configure +RUN make + +# start again with a new image +FROM scratch + +# get version +ARG VERSION + +# copy spx module from alpine image to the scratch image so files can be copied back to host +COPY --from=build /php-spx/modules/spx.so alpine-$VERSION/spx.so diff --git a/docker-build/Dockerfile-ubuntu b/docker-build/Dockerfile-ubuntu new file mode 100644 index 0000000..8f44210 --- /dev/null +++ b/docker-build/Dockerfile-ubuntu @@ -0,0 +1,42 @@ +ARG VERSION=latest +FROM ubuntu:${VERSION} AS build + +# https://dev.to/setevoy/docker-configure-tzdata-and-timezone-during-build-20bk +ENV TZ=Europe/Berlin +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# update system +RUN apt update +RUN apt upgrade -y + +# install git +RUN apt install -y git + +# install php development tools +RUN apt install -y php-dev + +# install zlib development tools +RUN apt install -y zlib1g-dev + +# clone php-spx +RUN git clone https://github.com/NoiseByNorthwest/php-spx.git + +# set workdir +WORKDIR /php-spx + +# checkout release +RUN git checkout tags/v0.4.10 + +# build php-spx +RUN phpize +RUN ./configure +RUN make + +# start again with a new image +FROM scratch + +# get version +ARG VERSION + +# copy spx module from ubuntu image to the scratch image so files can be copied back to host +COPY --from=build /php-spx/modules/spx.so ubuntu-$VERSION/spx.so diff --git a/docker-build/build.sh b/docker-build/build.sh new file mode 100644 index 0000000..fd90b13 --- /dev/null +++ b/docker-build/build.sh @@ -0,0 +1,8 @@ +# build for ubuntu 20.04 +DOCKER_BUILDKIT=1 docker build --file Dockerfile-ubuntu --build-arg "VERSION=20.04" --output type=local,dest=lib . + +# build for ubuntu 18.04 +DOCKER_BUILDKIT=1 docker build --file Dockerfile-ubuntu --build-arg "VERSION=18.04" --output type=local,dest=lib . + +# build for alpine 3.14.0 +DOCKER_BUILDKIT=1 docker build --file Dockerfile-alpine --build-arg "VERSION=3.14.0" --output type=local,dest=lib . diff --git a/docker-build/lib/alpine-3.12.1/spx.so b/docker-build/lib/alpine-3.12.1/spx.so new file mode 100644 index 0000000..b15114e Binary files /dev/null and b/docker-build/lib/alpine-3.12.1/spx.so differ diff --git a/docker-build/lib/ubuntu-18.04/spx.so b/docker-build/lib/ubuntu-18.04/spx.so new file mode 100644 index 0000000..e61d3bb Binary files /dev/null and b/docker-build/lib/ubuntu-18.04/spx.so differ diff --git a/docker-build/lib/ubuntu-20.04/spx.so b/docker-build/lib/ubuntu-20.04/spx.so new file mode 100644 index 0000000..6878ee7 Binary files /dev/null and b/docker-build/lib/ubuntu-20.04/spx.so differ