I've been running composer install in a shell script when I build a docker image, but that along with a lot of other calls is making my build super slow and I'm wondering if there's a better/different way to go about this.
As #janshair-khan points out, there are two images. But composer/composer is deprecated, as you can see from the source repository. So I suggest you use the Docker Official Image for composer.
Related
I am very new to docker and laradock, but I am trying to figure out how to create a new container that comes with composer 2.0 (or latest) installed automatically? How do I tell Laradock that I want the latest composer upon build/creation of the container?
I have followed several tutorials and several posts about this type of situation...however, nothing has panned out. If I build the container, and start the workspace bash, it comes up with composer 1.10 every time. I can update it from within the container, but I would prefer to have it installed by default, when the container is created. Thanks in advance.
You have a few options. Two that spring to mind are:
You can use the RUN command in your docker file to run pretty much any commands
you like. So you could in theory install composer this way.
You can manually install composer and then build a new image. The new image will contain the composer install. You then push that to your repo of choice and use it as the base image in your dockerfile. This is quite common practice.
I've got a Laravel project and simple pipeline in Jenkins which build Docker image from Dockerfile, pull code in it and execute composer install. Everything working fine so far, but installing composer packages takes a lot of time (like 6-7 minutes). I've tried to persist vendor directory somewhere, create symlink to it or something but nothing worked so far. I wonder if there is some better more official way to handle that? Anyone has some idea or experience in it? Or maybe some different CI tool?
Ok, I ended up with two solutions:
I mounted composer cache directory to some directory in host to speed up composer packages installing:
dockerfile {
filename 'Dockerfile'
args '-v $HOME/composer_cache:/.composer/cache'
}
There is (not so obvious, because Jenkins panel is little messy) option to disable workspace clean up before/after code checkout. One can delete those steps in pipeline configuration under "Branch Sources" section (with red X above those "Behaviours").
I am new to Drupal and just looking for some help getting my dev environment going and using best practices.
So I have a working container with drupal, mariadb, drush etc... so after installing Drupal with the installer, I install themes and such however it seems if I drop the container I lose all my work. How could I ever work in a team then? How do I keep that work? Do I use git inside the container and pull and push from within?
As far as I'm aware, work inside the container does not necessarily reflect into my local working directory.
Any help would be much appreciated.
I dont know about dupral but generally in docker you would mount a folder from your local filesystem where docker is running when you start the container. The data in the "/your/local/folder" will be accessible both in the container and in your local filesystem. It'll also survive a restart of the container.
docker run -d \
-v </your/local/folder>:</folder in container>:z \
<your image>
The trick will be to identify the data in the container you want on your local filesystem.
Look here for different alternative ways to handle persistent data in docker:
https://docs.docker.com/storage/volumes/
I can highly recommend you Lando for Drupal 8.
SEE: https://docs.devwithlando.io/tutorials/drupal8.html
It's a free, open-source, cross-platform, local development environment and DevOps tool built on Docker container technology.
I'm using ubuntu 14.04, attempting to build and install php 5.3.22. I am unable to build as when I enter 'make' I get:
make: *** No targets specified and no makefile found. Stop.
Doing some research, it means that there is no Makefile, which should have been created when I ran ./configure. I got no error or feedback when running ./configure, nor do I get anything when I run ./configure --help. I'm in the correct build directory, otherwise I would get 'command not found?'
Other solutions suggest running autogen.sh, but I think that's only when you are building from a repo.
I also read that there should be a Makefile.in file somewhere, but I do not see that in the directory.
I just want to be able to properly configure and get a generated Makefile so I can build.
To generate the configure script, try running ./buildconf --force. I've not done this myself but got this by looking at the source repo and a couple of Google searches.
Before you can build PHP you first need to obtain its source code. There are two ways to do this: You can either download an archive from PHP’s download page or clone the git repository from git.php.net (or the mirror on Github).
The build process is slightly different for both cases: The git repository doesn’t bundle a configure script, so you’ll need to generate it using the buildconf script, which makes use of autoconf. Furthermore the git repository does not contain a pregenerated parser, so you’ll also need to have bison installed.
PHP Internals Book
I'm developing a PHP-App using composer.
Now I need a PHP-Libary, which is also developed by me.
Inside the IDE there is no problem using the library-classes. But when the app is running inside Apache2 I need to install the library via "composer update".
But when I change some library-class I always need to reinstall the new code via composer. Before that I have to push my changes to the SCM.
Is there a way to simplify this process during development?
After trying out symlinks, the solution for me is symlinking the dependend library with ln -s TARGET NAME. Adding the dependency to composer.json is for generating the classmaps and running without errors after deleting the symlink. It works fine. Also a "composer update" is working without overriding the symlink. New classes are found immedeately without doing the whole process described in the question.