Skip to content

Commit

Permalink
use main tmp folder instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Sep 30, 2024
1 parent fe34506 commit a8864d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ RUN \
rm storage/framework/views/* 2> /dev/null || true && \
rm storage/logs/* 2> /dev/null || true && \
chown -R www-data:www-data /var/www/html/Lychee && \
chmod -R g+ws storage/image-jobs && \
chmod -R g+ws storage/images-jobs || true && \
chmod -R g+ws storage/livewire-tmp || true && \
chmod -R g+ws storage/image-tmp || true && \
chmod -R g+ws storage/extract-jobs || true && \
chmod -R g+ws storage/lychee-tmp && \
echo "* * * * * www-data cd /var/www/html/Lychee && php artisan schedule:run >> /dev/null 2>&1" >> /etc/crontab && \
apt-get purge -y --autoremove git composer && \
apt-get clean -qy &&\
Expand Down Expand Up @@ -105,7 +104,7 @@ COPY --from=static_builder --chown=www-data:www-data /app/public /var/www/html/L
COPY default.conf /etc/nginx/nginx.conf

EXPOSE 80
VOLUME /conf /uploads /sym /logs /image-tmp /image-jobs /extract-jobs
VOLUME /conf /uploads /sym /logs /lychee-tmp

WORKDIR /var/www/html/Lychee

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
- ./lychee/uploads:/uploads
- ./lychee/sym:/sym
- ./lychee/logs:/logs
- ./lychee/tmp:/lychee-tmp
networks:
- lychee
environment:
Expand Down
40 changes: 12 additions & 28 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ if [ -n "$STARTUP_DELAY" ]
fi


echo "**** Make sure the /conf /uploads /sym /logs folders exist ****"
echo "**** Make sure the /conf /uploads /sym /logs /lychee-tmp folders exist ****"
[ ! -d /conf ] && mkdir -p /conf
[ ! -d /uploads ] && mkdir -p /uploads
[ ! -d /sym ] && mkdir -p /sym
[ ! -d /logs ] && mkdir -p /logs
[ ! -d /image-tmp ] && mkdir -p /image-tmp
[ ! -d /image-jobs ] && mkdir -p /image-jobs
[ ! -d /extract-jobs ] && mkdir -p /extract-jobs
[ ! -d /lychee-tmp ] && mkdir -p /lychee-tmp

echo "**** Create the symbolic link for the /uploads folder ****"
[ ! -L /var/www/html/Lychee/public/uploads ] && \
Expand All @@ -61,26 +59,12 @@ echo "**** Create the symbolic link for the /logs folder ****"
rm -r /var/www/html/Lychee/storage/logs && \
ln -s /logs /var/www/html/Lychee/storage/logs

echo "**** Create the symbolic link for the /image-tmp folder ****"
[ ! -L /var/www/html/Lychee/storage/image-tmp ] && \
touch /var/www/html/Lychee/storage/image-tmp/empty_file && \
cp -r /var/www/html/Lychee/storage/image-tmp/* /image-tmp && \
rm -r /var/www/html/Lychee/storage/image-tmp && \
ln -s /image-tmp /var/www/html/Lychee/storage/image-tmp

echo "**** Create the symbolic link for the /image-jobs folder ****"
[ ! -L /var/www/html/Lychee/storage/image-jobs ] && \
touch /var/www/html/Lychee/storage/image-jobs/empty_file && \
cp -r /var/www/html/Lychee/storage/image-jobs/* /image-jobs && \
rm -r /var/www/html/Lychee/storage/image-jobs && \
ln -s /image-jobs /var/www/html/Lychee/storage/image-jobs

echo "**** Create the symbolic link for the /extract-jobs folder ****"
[ ! -L /var/www/html/Lychee/storage/extract-jobs ] && \
touch /var/www/html/Lychee/storage/extract-jobs/empty_file && \
cp -r /var/www/html/Lychee/storage/extract-jobs/* /extract-jobs && \
rm -r /var/www/html/Lychee/storage/extract-jobs && \
ln -s /extract-jobs /var/www/html/Lychee/storage/extract-jobs
echo "**** Create the symbolic link for the /lychee-tmp folder ****"
[ ! -L /var/www/html/Lychee/storage/tmp ] && \
touch /var/www/html/Lychee/storage/tmp/empty_file && \
cp -r /var/www/html/Lychee/storage/tmp/* /lychee-tmp && \
rm -r /var/www/html/Lychee/storage/tmp && \
ln -s /lychee-tmp /var/www/html/Lychee/storage/tmp

cd /var/www/html/Lychee

Expand Down Expand Up @@ -166,12 +150,12 @@ if [ -n "$SKIP_PERMISSIONS_CHECKS" ] && [ "${SKIP_PERMISSIONS_CHECKS,,}" = "yes"
else
echo "**** Set Permissions ****"
# Set ownership of directories, then files and only when required. See LycheeOrg/Lychee-Docker#120
find /sym /uploads /logs /image-tmp /image-jobs /extract-jobs -type d \( ! -user "$USER" -o ! -group "$USER" \) -exec chown -R "$USER":"$USER" \{\} \;
find /conf/.env /sym /uploads /logs /image-tmp /image-jobs /extract-jobs \( ! -user "$USER" -o ! -group "$USER" \) -exec chown "$USER":"$USER" \{\} \;
find /sym /uploads /logs /lychee-tmp -type d \( ! -user "$USER" -o ! -group "$USER" \) -exec chown -R "$USER":"$USER" \{\} \;
find /conf/.env /sym /uploads /logs /lychee-tmp \( ! -user "$USER" -o ! -group "$USER" \) -exec chown "$USER":"$USER" \{\} \;
# Laravel needs to be able to chmod user.css and custom.js for no good reason
find /conf/user.css /conf/custom.js /logs/laravel.log \( ! -user "www-data" -o ! -group "$USER" \) -exec chown www-data:"$USER" \{\} \;
find /sym /uploads /logs /image-tmp /image-jobs /extract-jobs -type d \( ! -perm -ug+w -o ! -perm -ugo+rX -o ! -perm -g+s \) -exec chmod -R ug+w,ugo+rX,g+s \{\} \;
find /conf/user.css /conf/custom.js /conf/.env /sym /uploads /logs /image-tmp /image-jobs /extract-jobs \( ! -perm -ug+w -o ! -perm -ugo+rX \) -exec chmod ug+w,ugo+rX \{\} \;
find /sym /uploads /logs /lychee-tmp -type d \( ! -perm -ug+w -o ! -perm -ugo+rX -o ! -perm -g+s \) -exec chmod -R ug+w,ugo+rX,g+s \{\} \;
find /conf/user.css /conf/custom.js /conf/.env /sym /uploads /logs /lychee-tmp \( ! -perm -ug+w -o ! -perm -ugo+rX \) -exec chmod ug+w,ugo+rX \{\} \;
fi

# Update CA Certificates if we're using armv7 because armv7 is weird (#76)
Expand Down

0 comments on commit a8864d4

Please sign in to comment.