Comments (8)
-
Add a Composer service, mounting the volumes:
composer: image: composer/composer volumes_from: php-fpm working_dir: /var/www/html
-
Run Composer through
docker-compose
:docker-compose run composer install
from docker-composer.
Do you have either a Dockerfile or docker-compose.yml that you could send over to test? The idea is here is that you mount the volumes across the containers, and then run Composer through the Composer container.
from docker-composer.
I am using this docker-compose.yml
:
version: '2'
services:
php-fpm:
build:
context: ./php-fpm
image: plf_php-fpm:5.6
links:
- mysql:mysql
- redis:redis
environment:
- MYSQL_HOST=mysql
- MYSQL_USER=platform-admin
- MYSQL_PASSWORD=platform123
- MYSQL_DATABASE=platform
- REDIS_HOST=redis
depends_on:
- redis
- mysql
volumes:
- ../src/:/var/www/html/
- ./php-fpm/www.conf:/usr/local/etc/php-fpm.d/www.conf
nginx:
image: nginx:1.7.10
ports:
- 8080:80
links:
- php-fpm:php-fpm
volumes_from:
- php-fpm
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/
depends_on:
- php-fpm
mysql:
build:
context: ./mysql
image: meotimdihia/plf_mysql:5.7
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/import/dump.sql:/tmp/dump.sql
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_USER=platform-admin
- MYSQL_PASSWORD=platform123
- MYSQL_DATABASE=platform
redis:
image: redis:3-alpine
jenkins:
image: jenkins:2.3
ports:
- 8060:8080
- 50000:50000
volumes:
- ./jenkins/home:/var/jenkins_home
- ../src/:/var/www/html/
My workflow is like this:
- Push my code to github repository
- Github webhook request to my Jenkins container URL
- Jenkins container pull github repository
-runComposer install
at here . - Build test and deploy code
But how to execute composer install
container here ?
Now i recognize this problem should be at docker groups. But if you can suggest me , its a big help. :)
from docker-composer.
We can run docker-composer on host machine , but i wonder we can execute composer install
in Jenkins container , because i need to execute automatically composer install
.
In real my case i am trying to setup on kubernetes (google container engine) and docker-compose on localhost.
from docker-composer.
Another solution is to change the entrypoint and command and make your own script to run Composer install when the service starts.
from docker-composer.
thx for your answer, after some research in docker's documention, i see docker remote API :
https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/exec-create
And
kubernetes API :
http://kubernetes.io/kubernetes/third_party/swagger-ui/#!/api%2Fv1/connectPostNamespacedPodExec
i will try to follow this direction: Jenkin's container will call remote API to execute a command in Composer's container.
I close this issue, thank you once again.
from docker-composer.
@RobLoach I've been trying the past two days to include auto composer commands in my docker-compose file and failing.
Could you share with us your solution if you have got one.
version: "3"
services:
composer:
image: composer/composer:php5-alpine
volumes:
- ./app/:/app
command: ["install --ignore-platform-reqs", "dump-autoload --optimize"]
from docker-composer.
- Make sure your
/app
folder has a composer.json. - Try the
working_dir
as per #88 (comment).
from docker-composer.
Related Issues (20)
- Warning: This development build of composer is over 60 days old. HOT 2
- How to mount the composer cache into the container? HOT 4
- --no-interaction appears to be implied HOT 1
- ERROR: docker run --rm -v $PWD/:/app composer/composer install HOT 1
- the requested PHP extension intl is missing HOT 3
- Pear is broken HOT 1
- PEAR tmp fix breaks the builds of Alpine-based images HOT 1
- iconv() not working
- Composer require very slow HOT 4
- new docker images? HOT 6
- configure: error: Please reinstall the BZip2 distribution HOT 1
- Add soap
- Error when installing composer HOT 10
- composer/composer:php7 php eversion HOT 5
- error: cannot run ssh: No such file or directory fatal: unable to fork
- master-php7.1.4-alpine not found by docker. HOT 1
- Add docker-compose example to README HOT 1
- Too Many Deps HOT 3
- How to add extension php-intl HOT 3
- Issue with docker-php-ext-install with the alpine image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-composer.