FROM 32bit/ubuntu:14.04
# To run a container from this image:
# docker run -v $PWD:/p4php-dev <container_name>
# This Dockerfile assumes that the p4-php source code, and any dependencies,
# Will be mounted in /p4php-dev in the following directories
# //depot/main/p4-php -> p4php
# //3rd_party/cpp_libraries/openssl -> openssl
# //depot/main/p4 -> main/p4
# //depot/main/p4-bin/lib.linux26x86_64 -> main/p4-bin/lib.linux26x86_64
# //builds/main/p4-bin/bin.linux26x86_64/p4api.tgz -> p4api
ENV PHPVER 5.5.37
# Set 32-bit mode for all commands invoked with /bin/sh and /bin/bash
RUN mv /bin/sh /bin/sh.orig && \
echo '#!/bin/sh.orig\n/usr/bin/linux32 /bin/sh.orig "$@"' > /bin/sh && \
chmod +x /bin/sh
RUN mv /bin/bash /bin/bash.orig && \
echo '#!/bin/bash.orig\n/usr/bin/linux32 /bin/bash.orig "$@"' > /bin/bash && \
chmod +x /bin/bash
# Create source directories for building php and p4php
RUN mkdir /p4php-dev /php /php-src
# Install necessary packages
RUN apt-get update && apt-get install -y \
autoconf \
build-essential \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
pkg-config \
wget
# Copy build scripts
COPY php-get.sh /tmp/php-get.sh
COPY build-php.sh /tmp/build-php.sh
# Build PHP
RUN /tmp/php-get.sh $PHPVER
RUN /tmp/build-php.sh $PHPVER
# Add PHP to the path
ENV PATH /php/bin:$PATH
WORKDIR /p4php-dev
# Everything else should be mounted in /p4php-dev, so just run it:
CMD ["/p4php-dev/build-p4php.sh"]