forked from factorysh/docker-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.7.x-composer
46 lines (37 loc) · 1.62 KB
/
Dockerfile.7.x-composer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ARG PHP_MINOR_VERSION
FROM bearstech/php-cli:7.${PHP_MINOR_VERSION}
ARG PHP_MINOR_VERSION
ARG uid=1001
ENV COMPOSER_CACHE_DIR=/.cache
ENV COMPOSER_NO_INTERACTION=1
ENV XDG_CONFIG_HOME=/home/composer
USER root
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
git \
gzip \
mercurial \
p7zip \
php7.${PHP_MINOR_VERSION}-dev \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV SHA384_COMPOSER_SETUP 93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8
ENV SHA256_COMPOSER_BIN ec3428d049ae8877f7d102c2ee050dbd51a160fc2dde323f3e126a3b3846750e
RUN set -eux \
# Installer composer the standard way from getcomposer.org
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === '${SHA384_COMPOSER_SETUP}') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& echo "${SHA256_COMPOSER_BIN} /usr/local/bin/composer" | sha256sum -c \
&& useradd composer --uid ${uid} --shell /bin/bash \
&& mkdir /composer \
&& chown -R composer:composer /composer
SHELL ["/bin/sh", "-c"]
USER composer
WORKDIR /composer
CMD ["composer"]