Skip to content

Commit

Permalink
fix(docker): 修复构建入口
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Jul 17, 2018
1 parent 4c5689a commit 7d71511
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Dockerfile-fpm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM php:7.2-fpm

# install the PHP extensions we need
RUN set -ex; \
pecl channel-update pecl.php.net; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
Expand Down Expand Up @@ -65,7 +66,7 @@ RUN set -ex; \
rm -rf /var/www; \
mkdir /var/www; \
chown -R www-data:www-data /usr/src/plus; \
chown -R www-data:www-data /var/www;
chown -R www-data:www-data /var/www
USER www-data
RUN set -ex; \
composer install \
Expand All @@ -74,8 +75,10 @@ RUN set -ex; \
--classmap-authoritative \
--ignore-platform-reqs \
--working-dir=/usr/src/plus

USER root
COPY docker-entrypoint.sh /usr/local/bin/
RUN set -ex; \
chmod -f +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]

WORKDIR /var/www
Expand Down
8 changes: 4 additions & 4 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
set -euo pipefail

PLUS_NAME=Plus\(ThinkSNS\+\)
PLUS_SRC_PATH=/var/src/plus
PLUS_SRC_PATH=/usr/src/plus
PLUS_TARGET_PATH=/var/www
PHP_FPM_RUNNING_USER=www-data
PHP_FPM_RUNNING_GROUP=www-data

if ! [ -e $PLUS_SRC_PATH/public/index.php -o "$(ls -A $PLUS_SRC_PATH)" ]; then
echo >&2 "\033[31m ERROR: \033[0m The $PLUS_NAME code was not found in PHP-FPM container path \"$PLUS_SRC_PATH\""
echo >&2 "ERROR: The $PLUS_NAME code was not found in PHP-FPM container path \"$PLUS_SRC_PATH\""
exit 1
fi

if ! [ -e $PLUS_TARGET_PATH/plus/index -o "$(ls -A $PLUS_TARGET_PATH)" ]; then
echo >&2 "$PLUS_NAME not found in \"$PLUS_TARGET_PATH\" - copying now..."

if [ "$(ls -A $PLUS_TARGET_PATH)" ]; then
echo >&2 "\033[33m WARNING: \033[0m \"$PLUS_TARGET_PATH\" is not empty - press \033[42;30m Ctrl+C \033[0m now if this is an error!"
echo >&2 "WARNING: \"$PLUS_TARGET_PATH\" is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A $PLUS_TARGET_PATH; sleep 10 )
fi

Expand All @@ -30,7 +30,7 @@ if ! [ -e $PLUS_TARGET_PATH/plus/index -o "$(ls -A $PLUS_TARGET_PATH)" ]; then
--group "$PHP_FPM_RUNNING_GROUP" \
. | tar --extract --file -

echo >&2 "\033[32m SUCCESS: \033[0m Complete! $PLUS_NAME has been successfully copied to \"$PLUS_TARGET_PATH\""
echo >&2 "SUCCESS: Complete! $PLUS_NAME has been successfully copied to \"$PLUS_TARGET_PATH\""
fi

if ! [ -e $PLUS_TARGET_PATH/storage/configure/.env ]; then
Expand Down

0 comments on commit 7d71511

Please sign in to comment.