Skip to content

Commit

Permalink
tweak docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
alcohol committed Sep 4, 2018
1 parent 7ab2986 commit 3bae622
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 35 deletions.
17 changes: 9 additions & 8 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
*
!bin
!docs
!res
!src
!views
!composer.json
!composer.lock
!LICENSE
!/bin/
!/docs/
!/res/
!/src/
!/views/
!/composer.json
!/composer.lock
!/LICENSE
!/php-cli.ini
44 changes: 17 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
FROM php:7-alpine
FROM php:7-cli-alpine

MAINTAINER https://github.com/composer/satis

RUN apk --no-cache add curl git subversion mercurial openssh openssl tini zlib-dev

RUN docker-php-ext-install zip \
&& echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini" \
&& echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini"
RUN apk --no-cache add curl git subversion mercurial openssh openssl tini \
&& apk add --update --no-cache --virtual .build-deps zlib-dev \
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) zip \
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --virtual .phpext-rundeps $runDeps \
&& apk del .build-deps

ENV COMPOSER_HOME /composer
ENV PATH "/composer/vendor/bin:$PATH"
ENV COMPOSER_ALLOW_SUPERUSER 1

RUN mkdir /build \
&& mkdir /composer \
&& chmod -R 777 /composer \
&& curl -sfLo /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -sfLo /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r " \
\$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \
\$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \
if (!hash_equals(\$signature, \$hash)) { \
unlink('/tmp/composer-setup.php'); \
echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
exit(1); \
}" \
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer \
&& composer --no-interaction --no-ansi --version \
&& rm /tmp/composer-setup.php
COPY php-cli.ini /usr/local/etc/php/
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /satis

COPY ["composer.json", "composer.lock", "/satis/"]

RUN composer install --no-interaction --no-ansi --no-autoloader --no-scripts --no-plugins --no-dev

COPY bin /satis/bin/
COPY res /satis/res/
COPY views /satis/views/
COPY src /satis/src/
COPY views /satis/views/

RUN composer dump-autoload --no-interaction --no-ansi --optimize --no-dev
RUN composer install --no-interaction --no-ansi --no-scripts --no-plugins --no-dev --optimize-autoloader \
&& rm -rf /composer/cache/files/* /composer/cache/repo/*

ENTRYPOINT ["/sbin/tini", "-g", "--", "/satis/bin/docker-entrypoint.sh"]

Expand Down
38 changes: 38 additions & 0 deletions php-cli.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
; Maximum amount of memory a script may consume
memory_limit = -1

; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for. The recommended way of setting values for this
; directive is through the use of the error level constants and bitwise
; operators.
error_reporting = -1

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
display_errors = on

; The display of errors which occur during PHP's startup sequence are handled
; separately from display_errors. PHP's default behavior is to suppress those
; errors from clients. Turning the display of startup errors on can be useful in
; debugging configuration problems. We strongly recommend you
; set this to 'off' for production servers.
display_startup_errors = on

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
log_errors = on

; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
error_log = /tmp/php.log

; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at all.
log_errors_max_len = 0

0 comments on commit 3bae622

Please sign in to comment.