feat(): improve permission

pull/45/head
Magicalex 2019-12-28 23:47:12 +01:00
parent c8707ede82
commit 4cfcb970ab
No known key found for this signature in database
GPG Key ID: A89B48B1788C3CB5
2 changed files with 7 additions and 6 deletions

View File

@ -51,8 +51,7 @@ RUN apk add --no-progress --no-cache \
&& chmod +x /usr/local/bin/composer \ && chmod +x /usr/local/bin/composer \
&& composer global require --no-progress --no-suggest -- hirak/prestissimo \ && composer global require --no-progress --no-suggest -- hirak/prestissimo \
&& mkdir -p /flarum/app \ && mkdir -p /flarum/app \
&& chown -R $UID:$GID /flarum \ && COMPOSER_CACHE_DIR="/tmp" composer create-project --stability=beta --no-progress -- flarum/flarum /flarum/app $VERSION \
&& COMPOSER_CACHE_DIR="/tmp" su-exec $UID:$GID composer create-project --stability=beta --no-progress -- flarum/flarum /flarum/app $VERSION \
&& composer clear-cache \ && composer clear-cache \
&& rm -rf /flarum/.composer /tmp/* \ && rm -rf /flarum/.composer /tmp/* \
&& apk del --purge curl && apk del --purge curl

View File

@ -17,7 +17,10 @@ sed -i "s/<PHP_MEMORY_LIMIT>/${PHP_MEMORY_LIMIT}/g" /etc/php7/php-fpm.conf
sed -i "s/<OPCACHE_MEMORY_LIMIT>/${OPCACHE_MEMORY_LIMIT}/g" /etc/php7/conf.d/00_opcache.ini sed -i "s/<OPCACHE_MEMORY_LIMIT>/${OPCACHE_MEMORY_LIMIT}/g" /etc/php7/conf.d/00_opcache.ini
# Set permissions # Set permissions
chown -R "${UID}:${GID}" /services /var/log /var/lib/nginx for folder in /services /var/log /var/lib/nginx; do
find ${folder} ! -user "${UID}" -exec chown "${UID}:${GID}" {} \;
find ${folder} ! -group "${GID}" -exec chown "${UID}:${GID}" {} \;
done
# Set log output to STDOUT if wanted (LOG_TO_STDOUT=true) # Set log output to STDOUT if wanted (LOG_TO_STDOUT=true)
if [ "${LOG_TO_STDOUT}" = true ]; then if [ "${LOG_TO_STDOUT}" = true ]; then
@ -110,9 +113,9 @@ else
-e "s|<FLARUM_TITLE>|${FLARUM_TITLE}|g" /flarum/app/config.yml -e "s|<FLARUM_TITLE>|${FLARUM_TITLE}|g" /flarum/app/config.yml
# Install flarum # Install flarum
chown -R "${UID}:${GID}" /flarum find /flarum ! -user "${UID}" -exec chown "${UID}:${GID}" {} \;
find /flarum ! -group "${GID}" -exec chown "${UID}:${GID}" {} \;
su-exec "${UID}:${GID}" php /flarum/app/flarum install --file=/flarum/app/config.yml su-exec "${UID}:${GID}" php /flarum/app/flarum install --file=/flarum/app/config.yml
echo "[INFO] End of flarum installation" echo "[INFO] End of flarum installation"
fi fi
@ -120,5 +123,4 @@ fi
find /flarum ! -user "${UID}" -exec chown "${UID}:${GID}" {} \; find /flarum ! -user "${UID}" -exec chown "${UID}:${GID}" {} \;
find /flarum ! -group "${GID}" -exec chown "${UID}:${GID}" {} \; find /flarum ! -group "${GID}" -exec chown "${UID}:${GID}" {} \;
# RUN !
exec su-exec "${UID}:${GID}" /bin/s6-svscan /services exec su-exec "${UID}:${GID}" /bin/s6-svscan /services