Run update.sh
This commit is contained in:
parent
4d746d2c96
commit
c8e37754a0
|
|
@ -58,15 +58,13 @@ You can read more about Composer in our [official documentation](https://getcomp
|
||||||
|
|
||||||
### Basic usage
|
### Basic usage
|
||||||
|
|
||||||
Running the `composer` image is as simple as follows:
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run --rm --interactive --tty \
|
$ docker run --rm --interactive --tty \
|
||||||
--volume $PWD:/app \
|
--volume $PWD:/app \
|
||||||
composer install
|
composer <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Persistent cache / global configuration
|
### Persist cache / global configuration
|
||||||
|
|
||||||
You can bind mount the Composer home directory from your host to the container to enable a persistent cache or share global configuration:
|
You can bind mount the Composer home directory from your host to the container to enable a persistent cache or share global configuration:
|
||||||
|
|
||||||
|
|
@ -74,12 +72,12 @@ You can bind mount the Composer home directory from your host to the container t
|
||||||
$ docker run --rm --interactive --tty \
|
$ docker run --rm --interactive --tty \
|
||||||
--volume $PWD:/app \
|
--volume $PWD:/app \
|
||||||
--volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \
|
--volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \
|
||||||
composer install
|
composer <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** this relies on the fact that the `COMPOSER_HOME` value is set to `/tmp` in the image by default.
|
**Note:** this relies on the fact that the `COMPOSER_HOME` value is set to `/tmp` in the image by default.
|
||||||
|
|
||||||
Or if you are following the XDG specification:
|
Or if your environment follows the XDG specification:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run --rm --interactive --tty \
|
$ docker run --rm --interactive --tty \
|
||||||
|
|
@ -88,7 +86,7 @@ $ docker run --rm --interactive --tty \
|
||||||
--volume ${COMPOSER_HOME:-$HOME/.config/composer}:$COMPOSER_HOME \
|
--volume ${COMPOSER_HOME:-$HOME/.config/composer}:$COMPOSER_HOME \
|
||||||
--volume ${COMPOSER_CACHE_DIR:-$HOME/.cache/composer}:$COMPOSER_CACHE_DIR \
|
--volume ${COMPOSER_CACHE_DIR:-$HOME/.cache/composer}:$COMPOSER_CACHE_DIR \
|
||||||
--volume $PWD:/app \
|
--volume $PWD:/app \
|
||||||
composer install
|
composer <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Filesystem permissions
|
### Filesystem permissions
|
||||||
|
|
@ -99,9 +97,13 @@ By default, Composer runs as root inside the container. This can lead to permiss
|
||||||
$ docker run --rm --interactive --tty \
|
$ docker run --rm --interactive --tty \
|
||||||
--volume $PWD:/app \
|
--volume $PWD:/app \
|
||||||
--user $(id -u):$(id -g) \
|
--user $(id -u):$(id -g) \
|
||||||
composer install
|
composer <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
See: https://docs.docker.com/engine/reference/run/#user for details.
|
||||||
|
|
||||||
|
> Note: Docker for Mac behaves differently and this tip might not apply to Docker for Mac users.
|
||||||
|
|
||||||
### Private repositories / SSH agent
|
### Private repositories / SSH agent
|
||||||
|
|
||||||
When you need to access private repositories, you will either need to share your configured credentials, or mount your `ssh-agent` socket inside the running container:
|
When you need to access private repositories, you will either need to share your configured credentials, or mount your `ssh-agent` socket inside the running container:
|
||||||
|
|
@ -112,12 +114,12 @@ $ eval $(ssh-agent); \
|
||||||
--volume $PWD:/app \
|
--volume $PWD:/app \
|
||||||
--volume $SSH_AUTH_SOCK:/ssh-auth.sock \
|
--volume $SSH_AUTH_SOCK:/ssh-auth.sock \
|
||||||
--env SSH_AUTH_SOCK=/ssh-auth.sock \
|
--env SSH_AUTH_SOCK=/ssh-auth.sock \
|
||||||
composer install
|
composer <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** On OSX this requires Docker For Mac v2.2.0.0 or later, see [docker/for-mac#410](https://github.com/docker/for-mac/issues/410).
|
**Note:** On OSX this requires Docker For Mac v2.2.0.0 or later, see [docker/for-mac#410](https://github.com/docker/for-mac/issues/410).
|
||||||
|
|
||||||
When combining the use of private repositories with running Composer as another user, you might run into non-existent user errors (thrown by ssh). To work around this, simply mount the host passwd and group files (read-only) into the container:
|
When combining the use of private repositories with running Composer as another user, you can run into non-existent user errors (thrown by ssh). To work around this, bind mount the host passwd and group files (read-only) into the container:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ eval $(ssh-agent); \
|
$ eval $(ssh-agent); \
|
||||||
|
|
@ -128,7 +130,7 @@ $ eval $(ssh-agent); \
|
||||||
--volume /etc/group:/etc/group:ro \
|
--volume /etc/group:/etc/group:ro \
|
||||||
--env SSH_AUTH_SOCK=/ssh-auth.sock \
|
--env SSH_AUTH_SOCK=/ssh-auth.sock \
|
||||||
--user $(id -u):$(id -g) \
|
--user $(id -u):$(id -g) \
|
||||||
composer install
|
composer <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
# Troubleshooting
|
# Troubleshooting
|
||||||
|
|
@ -156,7 +158,7 @@ Suggestions:
|
||||||
"config": {
|
"config": {
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "MAJOR.MINOR.PATCH",
|
"php": "MAJOR.MINOR.PATCH",
|
||||||
"ext-something": "1"
|
"ext-something": "MAJOR.MINOR.PATCH"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ RUN cpanm Carton \
|
||||||
&& mkdir -p /usr/src/app
|
&& mkdir -p /usr/src/app
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
ONBUILD COPY cpanfile* /usr/src/myapp
|
ONBUILD COPY cpanfile* /usr/src/app
|
||||||
ONBUILD RUN carton install
|
ONBUILD RUN carton install
|
||||||
|
|
||||||
ONBUILD COPY . /usr/src/app
|
ONBUILD COPY . /usr/src/app
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue