-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
.dockerignore | ||
.github | ||
.gitignore | ||
Dockerfile* | ||
|
||
.git/ | ||
Application/Runtime/ | ||
server/Application/Runtime/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
FROM webdevops/php-nginx:7.4-alpine | ||
|
||
COPY ./ /var/www/html/ | ||
RUN mkdir -p /showdoc_data/html | ||
RUN cp -R /var/www/html/ /showdoc_data/ | ||
RUN rm -rf /app && ln -s /var/www/html /app | ||
RUN echo "<?php echo file_get_contents('index.html'); ?>" > /var/www/html/web/index.php | ||
|
||
RUN echo "upload_max_filesize=5000M;" >> /opt/docker/etc/php/php.ini | ||
RUN echo "post_max_size=5000M;" >> /opt/docker/etc/php/php.ini | ||
RUN echo "client_max_body_size 5000m;" > /opt/docker/etc/nginx/vhost.common.d/10-general.conf | ||
|
||
RUN apk update | ||
RUN apk add --update nodejs npm | ||
RUN mv /showdoc_data/html/mock/ /showdoc_data/mock | ||
RUN (cd /showdoc_data/mock/ && npm install ) | ||
|
||
# 写环境变量 | ||
ENV SHOWDOC_DOCKER_VERSION 2.4 | ||
|
||
CMD if [ ! -f "/var/www/html/index.php" ]; then \cp -fr /showdoc_data/html/ /var/www/ ;fi \ | ||
;chmod 777 -R /var/www/ \ | ||
;(sleep 3 && cd /showdoc_data/html/server && php index.php /api/update/dockerUpdateCode && chmod 777 -R /var/www/ ) \ | ||
;(sleep 30 && cd /showdoc_data/mock/ && npm run start) \ | ||
& supervisord | ||
COPY ./ /var/www/html/ | ||
RUN bash /var/www/html/docker.build.sh | ||
|
||
CMD ["bash", "/var/www/html/docker.run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xe | ||
if [ ! -d /showdoc_data/html ]; then | ||
mkdir -p /showdoc_data/html | ||
fi | ||
cp -R /var/www/html/ /showdoc_data/ | ||
rm -rf /app | ||
ln -s /var/www/html /app | ||
echo "<?php echo file_get_contents('index.html'); ?>" >/var/www/html/web/index.php | ||
echo "upload_max_filesize=5000M;" >>/opt/docker/etc/php/php.ini | ||
echo "post_max_size=5000M;" >>/opt/docker/etc/php/php.ini | ||
echo "client_max_body_size 5000m;" >/opt/docker/etc/nginx/vhost.common.d/10-general.conf | ||
|
||
apk update | ||
apk add --update nodejs npm | ||
mv /showdoc_data/html/mock/ /showdoc_data/mock | ||
( | ||
cd /showdoc_data/mock/ | ||
npm install | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ ! -f "/var/www/html/index.php" ]; then | ||
\cp -fr /showdoc_data/html/ /var/www/ | ||
fi | ||
|
||
chmod 777 -R /var/www/ | ||
( | ||
sleep 3 | ||
cd /showdoc_data/html/server | ||
php index.php /api/update/dockerUpdateCode | ||
chmod 777 -R /var/www/ | ||
) | ||
( | ||
sleep 30 | ||
cd /showdoc_data/mock/ | ||
npm run start | ||
) | ||
|
||
supervisord |