Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ RUN \
php8.4-bcmath \
php8.4-intl \
libimage-exiftool-perl \
supervisor \
ffmpeg \
git \
jpegoptim \
Expand Down Expand Up @@ -112,6 +113,9 @@ COPY --from=static_builder --chown=www-data:www-data /app/public /var/www/html/L
# Add custom Nginx configuration
COPY default.conf /etc/nginx/nginx.conf

# Custom supervisor configuration
COPY laravel-worker.conf /etc/supervisor/conf.d/laravel-worker.conf

EXPOSE 80
VOLUME /conf /uploads /sym /logs /lychee-tmp

Expand Down
120 changes: 120 additions & 0 deletions Dockerfile.tentative
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Base image
FROM php:8.4-fpm-alpine AS base

# Arguments
# To use the latest Lychee release instead of master pass `--build-arg TARGET=release` to `docker build`
ARG TARGET=nightly
# To install composer development dependencies, pass `--build-arg COMPOSER_NO_DEV=0` to `docker build`
ARG COMPOSER_NO_DEV=1
# To use another branch instead of master pass `--build-arg BRANCH=some-branch` to `docker build`
# This is NOT compatible with the release target above
ARG BRANCH=master


RUN apk update --no-cache && \
apk upgrade --no-cache
RUN apk add --no-cache \
supervisor

FROM base AS build

COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

RUN apk add --no-cache \
$PHPIZE_DEPS \
linux-headers \
git
RUN apk add --no-cache \
freetype-dev \
jpeg-dev \
icu-dev \
libzip-dev && \
install-php-extensions zip bcmath exif intl pdo_mysql pdo_pgsql pdo_sqlite gd redis imagick

FROM build AS lychee_builder

RUN \
mkdir -p /var/www/html && \
cd /var/www/html && \
if [ "$TARGET" = "release" ] ; then RELEASE_TAG="-b v$(curl -s https://raw.githubusercontent.com/LycheeOrg/Lychee/master/version.md)" ; \
elif [ "$BRANCH" != "master" ] ; then RELEASE_TAG="-b $BRANCH" ; fi && \
git clone --depth 1 $RELEASE_TAG https://github.com/LycheeOrg/Lychee.git && \
mv Lychee/.git/refs/heads/$BRANCH Lychee/$BRANCH || cp Lychee/.git/HEAD Lychee/$BRANCH && \
mv Lychee/.git/HEAD Lychee/HEAD && \
rm -r Lychee/.git/* && \
mkdir -p Lychee/.git/refs/heads && \
mv Lychee/HEAD Lychee/.git/HEAD && \
mv Lychee/$BRANCH Lychee/.git/refs/heads/$BRANCH && \
echo "$TARGET" > /var/www/html/Lychee/docker_target && \
cd /var/www/html/Lychee && \
echo "Last release: $(cat version.md)" && \
composer install --prefer-dist && \
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 && \
rm -fr tests

# =============================================================================
# STAGE 2 : Build static assets
#
# This allows us to not include Node within the final container
# =============================================================================
FROM node:20 AS node_builder

RUN mkdir /app

RUN mkdir -p /app
WORKDIR /app
COPY --from=lychee_builder /var/www/html/Lychee /app

RUN \
npm ci --no-audit && \
npm run build

FROM base AS target

# #####################################
# # Install necessary libraries
# #####################################
RUN apk add --no-cache \
freetype \
jpeg \
icu \
libzip \
nginx

# #####################################
# # Copy extensions from build stage
# #####################################
COPY --from=build /usr/local/lib/php/extensions/no-debug-non-zts-20240924/* /usr/local/lib/php/extensions/no-debug-non-zts-20240924
COPY --from=build /usr/local/etc/php/conf.d/* /usr/local/etc/php/conf.d

COPY --from=lychee_builder --chown=www-data:www-data /var/www/html/Lychee /var/www/html
COPY --from=node_builder --chown=www-data:www-data /app/public /var/www/html/Lychee/public

# Add custom Nginx configuration
COPY default.conf /etc/nginx/nginx.conf

# Custom supervisor configuration
COPY laravel-worker.conf /etc/supervisor/conf.d/laravel-worker.conf

EXPOSE 80
VOLUME /conf /uploads /sym /logs /lychee-tmp

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" ]
55 changes: 54 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ services:
#- CACHE_DRIVER=file
#- SESSION_DRIVER=file
#- SESSION_LIFETIME=120
#- QUEUE_CONNECTION=sync
- QUEUE_CONNECTION=database
#- SECURITY_HEADER_HSTS_ENABLE=false
#- SECURITY_HEADER_CSP_CONNECT_SRC=
#- SECURITY_HEADER_CSP_FRAME_ANCESTORS=
Expand Down Expand Up @@ -128,6 +128,59 @@ services:
depends_on:
- lychee_db

lychee_worker:
image: lycheeorg/lychee
container_name: lychee_worker
security_opt:
- no-new-privileges:true
volumes:
- ./lychee/conf:/conf
- ./lychee/uploads:/uploads
- ./lychee/sym:/sym
- ./lychee/logs:/logs
- ./lychee/tmp:/lychee-tmp
env_file:
- path: ./.env
required: false
environment:
# queue will make sure that the entrypoint.sh script is starts the correct process.
- CONTAINER_ROLE=queue
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}
# PHP timezone e.g. PHP_TZ=America/New_York
- PHP_TZ=${TIMEZONE:-UTC}
- TIMEZONE=${TIMEZONE:-UTC}
- DB_CONNECTION=mysql
- DB_HOST=lychee_db
- DB_PORT=${DB_PORT:-3306}
- DB_DATABASE=${DB_DATABASE:-lychee}
- DB_USERNAME=${DB_USERNAME:-lychee}
- DB_PASSWORD=${DB_PASSWORD}
#- DB_PASSWORD_FILE=<filename>
#- CACHE_DRIVER=file
- QUEUE_CONNECTION=database
#- MAIL_DRIVER=smtp
#- MAIL_HOST=smtp.mailtrap.io
#- MAIL_PORT=2525
#- MAIL_USERNAME=null
#- MAIL_PASSWORD=null
#- MAIL_PASSWORD_FILE=<filename>
#- MAIL_ENCRYPTION=null
#- MAIL_FROM_NAME=
#- MAIL_FROM_ADDRESS=
- SKIP_PERMISSIONS_CHECKS=${SKIP_PERMISSIONS_CHECKS:-false}
- STARTUP_DELAY=30
- CACHE_DRIVER=${CACHE_DRIVER:-redis}
- REDIS_URL=redis://${REDIS_USERNAME:-default}:${REDIS_PASSWORD:-}@${REDIS_HOST:-lychee_redis}:${REDIS_PORT:-6379}
- REDIS_HOST=${REDIS_HOST:-lychee_redis}
- REDIS_PORT=${REDIS_PORT:-6379}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- LOG_VIEWER_CACHE_DRIVER=${LOG_VIEWER_CACHE_DRIVER:-file}
- VITE_HTTP_PROXY_ENABLED=${VITE_HTTP_PROXY_ENABLED:-false}
restart: unless-stopped
depends_on:
- lychee_db

networks:
lychee:

Expand Down
Loading