Setup Docker
This commit is contained in:
parent
54d1aecda3
commit
353b48394b
|
|
@ -0,0 +1,9 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
|
||||||
|
php:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./docker/Dockerfile
|
||||||
|
volumes:
|
||||||
|
- .:/usr/local/src/wellrested
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
FROM php:7.1-cli
|
||||||
|
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get -y install \
|
||||||
|
gettext \
|
||||||
|
libssl-dev \
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
zip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Xdebug
|
||||||
|
RUN yes | pecl install xdebug \
|
||||||
|
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
|
||||||
|
|
||||||
|
# Download and install Composer
|
||||||
|
COPY ./docker/install-composer.sh /tmp/install-composer.sh
|
||||||
|
RUN chmod +x /tmp/install-composer.sh; sync && \
|
||||||
|
/tmp/install-composer.sh && \
|
||||||
|
rm /tmp/install-composer.sh
|
||||||
|
|
||||||
|
# Create a directory for project sources and user's home directory
|
||||||
|
RUN mkdir /usr/local/src/wellrested && \
|
||||||
|
chown -R www-data:www-data /usr/local/src/wellrested && \
|
||||||
|
mkdir /var/www && \
|
||||||
|
chown -R www-data:www-data /var/www
|
||||||
|
|
||||||
|
COPY ./src /usr/local/src/wellrested/src
|
||||||
|
COPY ./test /usr/local/src/wellrested/test
|
||||||
|
COPY ./composer.* /usr/local/src/wellrested/
|
||||||
|
COPY ./phpunit.xml.dist /usr/local/src/wellrested/
|
||||||
|
|
||||||
|
# Add symlink for phpunit for easier running
|
||||||
|
RUN ln -s /usr/local/src/wellrested/vendor/bin/phpunit /usr/local/bin/phpunit
|
||||||
|
|
||||||
|
WORKDIR /usr/local/src/wellrested
|
||||||
|
|
||||||
|
USER www-data
|
||||||
|
|
||||||
|
# Install Composer dependencies
|
||||||
|
RUN composer install
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
EXPECTED_SIGNATURE=$(wget https://composer.github.io/installer.sig -O - -q)
|
||||||
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
|
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
|
||||||
|
|
||||||
|
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
|
||||||
|
>&2 echo 'ERROR: Invalid installer signature'
|
||||||
|
rm composer-setup.php
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
php composer-setup.php --quiet --filename=composer --install-dir=/usr/local/bin
|
||||||
|
RESULT=$?
|
||||||
|
rm composer-setup.php
|
||||||
|
exit $RESULT
|
||||||
Loading…
Reference in New Issue