Comments (12)
AFAIK .dockerignore
won't help in this case.
We are cloning inside the image, not outside and then doing a copy.
from lychee-docker.
Fair point that they're not required, but the .github
folder is only 55K. May be worth checking for anything larger though.
the last line should be enough
Good spot, thanks!
from lychee-docker.
Sample Folder is over 100MB
/var/www/html/Lychee/tests/Samples/
from lychee-docker.
Then why is this not working?
Lines 65 to 66 in d10de82
from lychee-docker.
maybe a better solution https://shisho.dev/blog/posts/how-to-use-dockerignore/
from lychee-docker.
When running it on my instance, it does find the,
root@vps:/var/docker/Lychee-docker perso ✗ 167d14h ◒
▶ docker exec -it lychee bash
root@e7d513f87a2f:/var/www/html/Lychee# find . -wholename '*/[Tt]ests/*'
./tests/LoadedSubscriber.php
./tests/Samples
./tests/Samples/xcf.xcf
./tests/Samples/gif.gif
./tests/Samples/night.jpg
./tests/Samples/orientation-180.jpg
./tests/Samples/train.jpg
./tests/Samples/orientation-90.jpg
./tests/Samples/tags.json
./tests/Samples/ettlinger-alb.jpg
./tests/Samples/hochuferweg.jpg
./tests/Samples/orientation-270.jpg
./tests/Samples/pdf.pdf
./tests/Samples/google_motion_photo_broken.jpg
./tests/Samples/gaming.mp4
./tests/Samples/tiff
./tests/Samples/webp.webp
./tests/Samples/google_motion_photo.jpg
./tests/Samples/train.mov
./tests/Samples/mongolia
./tests/Samples/tiff.tif
./tests/Samples/commits.json
./tests/Samples/without_exif.jpg
./tests/Samples/orientation-hflip.jpg
./tests/Samples/orientation-vflip.jpg
./tests/Samples/fin de journ??e.jpg
./tests/Samples/aarhus.jpg
./tests/Samples/mongolia.jpeg
./tests/Samples/undefined-exif-tag.jpg
./tests/Samples/png.png
./tests/Livewire
./tests/Livewire/WireableTest.php
./tests/Livewire/Forms
./tests/Livewire/Forms/ImportFromUrlTest.php
./tests/Livewire/Forms/Photo
...
from lychee-docker.
this command change the directory
Line 62 in d10de82
the delete command is use a dot, it therefore uses the current directory
from lychee-docker.
Nicely spotted!
from lychee-docker.
root@e7d513f87a2f:/var/www/html/Lychee# find . -wholename '*/[Tt]ests/*'
this command change the directory
Line 62 in d10de82
I'm missing something here. That's the directory we want it to run in. But yes, they're not being deleted.
from lychee-docker.
This appears to be a (somewhat) common issue with Docker builds.
from lychee-docker.
i have tried to integrate the git clone
module in a separate step. From there you could then only copy the files that are really needed. Possibly the error we have when deleting has to do with the onion structure of docker
https://medium.com/@samhavens/how-to-make-a-docker-container-smaller-by-deleting-files-7354b5c6c8f1
FROM debian:bookworm-slim as clone
# Arguments
# To use the latest Lychee release instead of master pass `--build-arg TARGET=release` to `docker build`
ARG TARGET=dev
WORKDIR /lychee
# Install base dependencies, add user and group, clone the repo and install php libraries
RUN \
set -ev && \
apt-get update && \
apt-get upgrade -qy && \
apt-get install -qy --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
git && \
update-ca-certificates
RUN \
if [ "$TARGET" = "release" ] ; then RELEASE_TAG="-b v$(curl -s https://raw.githubusercontent.com/LycheeOrg/Lychee/master/version.md)" ; fi && \
git clone --depth 1 $RELEASE_TAG https://github.com/LycheeOrg/Lychee.git . && \
find . -wholename '*/[Tt]ests/*' -delete && \
find . -wholename '*/[Tt]est/*' -delete && \
rm -r storage/framework/cache/data/* 2> /dev/null || true && \
rm storage/framework/sessions/* 2> /dev/null || true && \
rm storage/framework/views/* 2> /dev/null || true && \
rm storage/logs/* 2> /dev/null || true && \
echo "$TARGET" > docker_target
FROM debian:bookworm-slim as base
COPY --from=clone /lychee /var/www/html/Lychee
# Set version label
LABEL maintainer="lycheeorg"
# Environment variables
ENV PUID='1000'
ENV PGID='1000'
ENV USER='lychee'
ENV PHP_TZ=UTC
# Arguments
# To install composer development dependencies, pass `--build-arg COMPOSER_NO_DEV=0` to `docker build`
ARG COMPOSER_NO_DEV=1
# Install base dependencies, add user and group, clone the repo and install php libraries
RUN \
set -ev && \
apt-get update && \
apt-get upgrade -qy && \
apt-get install -qy --no-install-recommends \
adduser \
nginx-light \
php8.2-mysql \
php8.2-pgsql \
php8.2-sqlite3 \
php8.2-imagick \
php8.2-mbstring \
php8.2-gd \
php8.2-xml \
php8.2-zip \
php8.2-fpm \
php8.2-redis \
php8.2-bcmath \
php8.2-intl \
curl \
libimage-exiftool-perl \
ffmpeg \
jpegoptim \
optipng \
pngquant \
gifsicle \
webp \
cron \
composer \
unzip && \
addgroup --gid "$PGID" "$USER" && \
adduser --gecos '' --no-create-home --disabled-password --uid "$PUID" --gid "$PGID" "$USER" && \
cd /var/www/html/Lychee && \
echo "Last release: $(cat version.md)" && \
composer install --prefer-dist && \
chown -R www-data:www-data /var/www/html/Lychee && \
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 && \
rm -rf /var/lib/apt/lists/*
# Multi-stage build: Build static assets
# This allows us to not include Node within the final container
FROM node:20 as static_builder
WORKDIR /app
COPY --from=base /var/www/html/Lychee/ /app
RUN \
npm ci --no-audit && \
npm run build
# Get the static assets built in the previous step
FROM base
COPY --from=static_builder --chown=www-data:www-data /app/public /var/www/html/Lychee/public
# Add custom Nginx configuration
COPY default.conf /etc/nginx/nginx.conf
EXPOSE 80
VOLUME /conf /uploads /sym /logs
WORKDIR /var/www/html/Lychee
COPY entrypoint.sh inject.sh /
RUN chmod +x /entrypoint.sh && \
chmod +x /inject.sh && \
if [ ! -e /run/php ] ; then mkdir /run/php ; fi
HEALTHCHECK CMD curl --fail http://localhost:80/ || exit 1
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "nginx" ]
but he is still complaining about a file where I do not yet know exactly where this comes from
'/var/www/html/Lychee/.env': File exists
docker run 854c79503c4adac26a395e028fb97026476d309e297fb073073da24e32cf2d00
-------------------------------------
_ _
| | _ _ ___| |__ ___ ___
| | | | | |/ __| _ \ / _ \/ _ \
| |__| |_| | (__| | | | __/ __/
|_____\__, |\___|_| |_|\___|\___|
|___/
-------------------------------------
Lychee Version: 5.0.3 (dev)
Lychee Commit: c0c2e69
https://github.com/LycheeOrg/Lychee/commit/c0c2e693669206d8b27abed8aef947d7e253efa6
-------------------------------------
**** Make sure the /conf /uploads /sym /logs folders exist ****
**** Create the symbolic link for the /uploads folder ****
**** Create the symbolic link for the /sym folder ****
**** Create the symbolic link for the /logs folder ****
**** Copy the default database to /conf ****
**** Create the symbolic link for the database ****
**** Copy the .env to /conf ****
ln: failed to create symbolic link '/var/www/html/Lychee/.env': File exists
from lychee-docker.
Possibly the error we have when deleting has to do with the onion structure of docker
That was my first thought, and may be the case, but running them all in the same command stops Docker creating a new layer so should deal with that. The deletion of .git content is working.
from lychee-docker.
Related Issues (20)
- Lychee gallery not working anymore after recent update. HOT 8
- DB Error on upgrade HOT 4
- DB error since update HOT 5
- Document config parameters that are required for reverse HTTPS proxies HOT 1
- brand new site can't see images HOT 15
- Error 507 NoWriteAccessOnLogsExceptions HOT 10
- Running on subpath with nginx HOT 1
- Any uploaded or 'php artisisan lychee:sync /path/' image is blank and unviewable. HOT 14
- New environment variables not added to environment file HOT 1
- 404 docker-compose.yml on hub.docker.com HOT 1
- Photos won't show up in gallery HOT 11
- SQL Error
- Connection refused HOT 1
- 500 HttpException Attempt to read property "photo_id" on null HOT 2
- Lychee won't work after host reboot HOT 4
- new deploy with installer won't work HOT 14
- Can not update or edit Lychee Permission Denied
- Error 500 clean install SQL migration problem HOT 1
- Lychee container should not modify files outside of mounts HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lychee-docker.