昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期二, 五月 01, 2018

Run multiple commands in dockerFile CMD

FROM php:alpine
RUN apk update && apk add zip libxml2-dev libpng-dev && docker-php-ext-install mysqli simplexml mbstring gd 
RUN \
mkdir /var/www && \
cd /var/www && mkdir mybb && cd mybb && \
unzip mybb.zip "Upload/*" && \
mv Upload/* . && \
rm -Rf Upload mybb.zip && \
mv inc/config.default.php inc/config.php && \
chmod 666 inc/config.php inc/settings.php && \
chmod -R 777 inc/languages && \
chmod 777 cache/ cache/themes/ uploads/ uploads/avatars/ admin/backups/
WORKDIR /var/www
EXPOSE 80
CMD ["sh","-c","[ \"$(ls -A forum)\" ] && (echo \"Forum exist\" && php -S 0.0.0.0:80 -t forum) || (echo \"Forum does not exist, copying...\" && cp -R mybb/* forum && php -S 0.0.0.0:80 -t forum) "]




--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.