Skip to content

Instantly share code, notes, and snippets.

@AlexanderAllen
Last active January 1, 2020 21:39
Show Gist options
  • Save AlexanderAllen/aa9a39155344324e102ff4f5b983fb28 to your computer and use it in GitHub Desktop.
Save AlexanderAllen/aa9a39155344324e102ff4f5b983fb28 to your computer and use it in GitHub Desktop.
Alpine Docker Image for Composer
FROM alexanderallen/php7-fpm.core:alpine-3.11 as core
ENV \
SSH_PRIVATE_KEY="/root/.ssh/id_rsa" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
TERM="xterm" \
# Register the COMPOSER_HOME environment variable.
COMPOSER_HOME=/composer \
# Add global binary directory to PATH.
PATH=/composer/vendor/bin:$PATH \
# Allow Composer to be run as root.
COMPOSER_ALLOW_SUPERUSER=1
RUN \
cd /tmp \
&& apk add --no-cache \
php7-mbstring \
php7-phar \
bash \
git \
mysql-client \
tar \
tree \
tmux \
vim \
zsh \
&& apk add --no-cache --virtual .networking \
curl \
net-tools \
nmap \
openssh-client \
wget \
&& git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# Setup the Composer installer.
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot && rm -rf /tmp/composer-setup.php
# Where all of our codebase is mounted to.
WORKDIR /www
# Core image CLI entrypoint.
# ENTRYPOINT ["/bin/zsh", "--interactive"]
ENTRYPOINT ["/bin/sh", "--interactive"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment