-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use docker-compose for faster volume switching
- Loading branch information
1 parent
abfc7c3
commit 7d79f11
Showing
3 changed files
with
25 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,12 @@ | ||
FROM php:cli | ||
|
||
# install composer and a bunch of dependencies | ||
RUN apt-get update && apt-get install -y git curl zip unzip zlib1g-dev | ||
COPY . /var/www | ||
WORKDIR /var/www | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y zip unzip zlib1g-dev | ||
RUN docker-php-ext-install zip | ||
RUN docker-php-ext-install pcntl | ||
RUN curl -sS https://getcomposer.org/installer | php | ||
RUN mv composer.phar /usr/local/bin/composer | ||
|
||
# pull in code | ||
WORKDIR /var/www | ||
COPY . . | ||
|
||
# install dependencies | ||
RUN rm -rf vendor | ||
RUN composer install | ||
|
||
# to support loading the directory as volume, we'll move vendor out of the way so it | ||
# doesn't get overwritten by more recent code; we'll put it back before running anything | ||
RUN mv vendor ../docker-vendor | ||
RUN echo 'mv /var/www/vendor /var/current-vendor 2>/dev/null || : && \ | ||
mv /var/docker-vendor /var/www/vendor && \ | ||
/bin/sh -c "$@" || : && \ | ||
mv /var/www/vendor /var/docker-vendor && \ | ||
mv /var/current-vendor /var/www/vendor 2>/dev/null || :' > /etc/run.sh | ||
ENTRYPOINT ["/bin/sh", "/etc/run.sh"] | ||
|
||
CMD ["vendor/bin/phpunit"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '3' | ||
services: | ||
php: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- ./src:/var/www/src | ||
- ./data:/var/www/data | ||
- ./tests:/var/www/tests | ||
- ./phpunit.xml.dist:/var/www/phpunit.xml.dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters