PHP Snippet 1:
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
PHP Snippet 2:
FROM php:7.1.3-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
PHP Snippet 3:
composer --version
Composer version 1.6.5 2018-05-04 11:44:59
PHP Snippet 4:
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
PHP Snippet 5:
#Get Composer
FROM composer:2.0 as vendor
WORKDIR /app
COPY database/ database/
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN composer install \
--no-interaction \
--no-plugins \
--no-scripts \
--no-dev \
--prefer-dist
COPY . .
RUN composer dump-autoload
PHP Snippet 6:
FROM node:14.9 as frontend
...
FROM php:7.4-fpm
...
PHP Snippet 7:
# Copy Composer dependencies
COPY --from=vendor app/vendor/ ./vendor/
COPY . .
PHP Snippet 9:
# Run Laravel commands
RUN php artisan optimize:clear
CMD php artisan serve --host=0.0.0.0 --port=8080
EXPOSE 8080
PHP Snippet 10:
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer && chmod +x /usr/bin/composer
PHP Snippet 11:
--install-dir=/usr/local/bin
PHP Snippet 12:
export PATH=$PATH":/usr/bin"
PHP Snippet 13:
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
PHP Snippet 14:
FROM php:7.3-fpm-alpine
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
RUN apk update
RUN apk upgrade
RUN apk add bash
RUN alias composer='php /usr/bin/composer'
PHP Snippet 15:
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
PHP Snippet 16:
FROM 8.1.4-fpm
RUN apt-get update && apt-get install -y \
git \
curl \
zip \
unzip
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /var/www