Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'

services:
php:
build:
context: ./docker
ports:
- "27017:27017"
environment:
XDEBUG_CONFIG: remote_host=REPLACE_WITH_YOUR_BRIDGE_IP
PHP_IDE_CONFIG: "serverName=docker"
volumes:
- .:/srv/php:rw,cached
- /opt:/opt
working_dir: /srv/php
25 changes: 25 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM php:7.3-fpm-alpine

RUN apk update && apk add autoconf openssl-dev g++ make openssl mongodb && \
pecl install mongodb && \
docker-php-ext-enable mongodb && \
apk del --purge autoconf openssl-dev g++ make

RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
pecl install \
xdebug \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable xdebug && \
apk del .build-deps && \
sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
sed -i '1 a xdebug.remote_log=/srv/php/tests/Fixtures/app/var/log/xdebug_remote.log' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

VOLUME /data/db

EXPOSE 27017
11 changes: 11 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi

mongod &

exec docker-php-entrypoint "$@"