Use composer create-project
This commit is contained in:
parent
33daa22c7a
commit
0f965c41a1
15
Dockerfile
15
Dockerfile
@ -1,13 +1,13 @@
|
|||||||
FROM php:7.1-fpm-alpine
|
FROM php:7.1-fpm-alpine
|
||||||
|
|
||||||
|
WORKDIR /srv/app
|
||||||
|
|
||||||
RUN apk add --no-cache --virtual .persistent-deps \
|
RUN apk add --no-cache --virtual .persistent-deps \
|
||||||
git \
|
git \
|
||||||
icu-libs \
|
icu-libs \
|
||||||
make \
|
|
||||||
zlib
|
zlib
|
||||||
|
|
||||||
ENV APCU_VERSION 5.1.8
|
ENV APCU_VERSION 5.1.8
|
||||||
|
|
||||||
RUN set -xe \
|
RUN set -xe \
|
||||||
&& apk add --no-cache --virtual .build-deps \
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
$PHPIZE_DEPS \
|
$PHPIZE_DEPS \
|
||||||
@ -38,22 +38,19 @@ RUN set -xe \
|
|||||||
ENV COMPOSER_ALLOW_SUPERUSER 1
|
ENV COMPOSER_ALLOW_SUPERUSER 1
|
||||||
|
|
||||||
# Use prestissimo to speed up builds
|
# Use prestissimo to speed up builds
|
||||||
RUN composer global require "hirak/prestissimo:^0.3" --prefer-dist --no-progress --no-suggest --optimize-autoloader --classmap-authoritative
|
RUN composer global require "hirak/prestissimo:^0.3" --prefer-dist --no-progress --no-suggest --optimize-autoloader --classmap-authoritative --no-interaction
|
||||||
|
|
||||||
COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
|
COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
|
||||||
RUN chmod +x /usr/local/bin/docker-app-entrypoint
|
RUN chmod +x /usr/local/bin/docker-app-entrypoint
|
||||||
|
|
||||||
# Download the Symfony skeleton and leverage Docker cache layers
|
# Download the Symfony skeleton and leverage Docker cache layers
|
||||||
ENV SKELETON_COMPOSER_JSON https://raw.githubusercontent.com/symfony/skeleton/v3.3.4/composer.json
|
ENV STABILITY stable
|
||||||
|
RUN composer create-project "symfony/skeleton" . --stability=$STABILITY --prefer-dist --no-dev --no-progress --no-scripts --no-plugins --no-interaction
|
||||||
WORKDIR /srv/app
|
|
||||||
RUN php -r "copy('$SKELETON_COMPOSER_JSON', 'composer.json');" \
|
|
||||||
&& composer install --prefer-dist --no-dev --no-progress --no-suggest --no-autoloader --no-scripts --no-plugins --no-interaction
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN mkdir -p var/cache var/logs var/sessions \
|
RUN mkdir -p var/cache var/logs var/sessions \
|
||||||
&& composer install --prefer-dist --no-dev --no-progress --no-suggest --optimize-autoloader --classmap-authoritative --no-interaction \
|
&& composer install --prefer-dist --no-dev --no-progress --no-suggest --classmap-authoritative --no-interaction \
|
||||||
&& composer clear-cache \
|
&& composer clear-cache \
|
||||||
&& chown -R www-data var # Permissions hack because setfacl does not work on Mac and Windows
|
&& chown -R www-data var # Permissions hack because setfacl does not work on Mac and Windows
|
||||||
|
|
||||||
|
@ -7,10 +7,13 @@ if [ "${1#-}" != "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then
|
if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then
|
||||||
# The first time volumes are mounted, dependencies need to be reinstalled
|
# The first time volumes are mounted, the project needs to be recreated
|
||||||
if [ ! -f composer.json ]; then
|
if [ ! -f composer.json ]; then
|
||||||
rm -Rf vendor/*
|
composer create-project "symfony/skeleton" tmp --stability=$STABILITY --prefer-dist --no-progress --no-interaction
|
||||||
php -r "copy('$SKELETON_COMPOSER_JSON', 'composer.json');"
|
cp -Rp tmp/. .
|
||||||
|
rm -Rf tmp/
|
||||||
|
elif [ "$APP_ENV" != 'prod' ]; then
|
||||||
|
# Always try to reinstall deps when not in prod
|
||||||
composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user