lycheeorg/lychee-laravel
Notice: Dockerhub repository has been migrated toMake sure you update your docker-compose files accordingly
Table of Contents
Image Content
This image features Lychee (Laravel version), nginx and PHP-FPM. The provided configuration (PHP, nginx...) follows Lychee's official recommandations.
The following tags are available :
latest
: current stable tagv[NUMBER]
: stable version tagdev
: current master branch tagtesting
: branch and pr tag for testing
Setup
Prerequisites
You must have a database docker running OR create one in your docker-compose.yml
.
- Create the db, username, password.
- Edit the environment variables (db credentials, language...) by :
- Supplying the environment variables via
docker run
/docker-compose
, or - Creating a
.env
file with the appropriate info and mount it to/conf/.env
.
- Supplying the environment variables via
Run with Docker
Make sure that you link to the container running your database !!
The example below shows --net
and --link
for these purposes. --net
connects to the name of the network your database is on and --link
connects to the database container.
docker run -d \
--name=lychee-laravel \
-v /host_path/lychee-laravel/conf:/conf \
-v /host_path/lychee-laravel/uploads:/uploads \
-v /host_path/lychee-laravel/sym:/sym \
-e PUID=1000 \
-e PGID=1000 \
-e PHP_TZ=America/New_York \
-e DB_CONNECTION=mysql \
-e DB_HOST=mariadb \
-e DB_PORT=3306 \
-e DB_DATABASE=homestead \
-e DB_USERNAME=homestead \
-e DB_PASSWORD=secret \
-p 90:80 \
--net network_name \
--link db_name \
lycheeorg/lychee-laravel
Warning : if you use a MySQL database, make sure to use the mysql_native_password
authentication plugin, either by using the --default-authentication-plugin
option when starting mysql, or by running a query to enable the authentication plugin for the lychee
user, e.g. :
alter user 'lychee' identified with mysql_native_password by '<your password>';
Run with Docker Compose
Change the environment variables in the provided example to reflect your database credentials.
Note that in order to avoid writing credentials directly into the file, you can create a db_secrets.env
and use the env_file
directive (see the docs).
Available environment variables and defaults
If you do not provide environment variables or .env
file, the example .env file will be used with some values already set by default.
Some variables are specific to Docker, and the default values are :
- PUID=1000
- PGID=1000
- USER=lychee
- PHP_TZ=America/New_York
Advanced configuration
Note that nginx will accept by default images up to 100MB (client_max_body_size 100M
) and that PHP parameters are overridden according to the recommendations of the Lychee-Laravel FAQ.
You may still want to further customize PHP configuration. The first method is to mount a custom php.ini
to /etc/php/7.3/fpm/php.ini
when starting the container. However, this method is kind of brutal as it will override all parameters.
Instead, we recommend to use the PHP_VALUE
directive of PHP-FPM to override specific parameters. To do so, you will need to mount a custom nginx.conf
in your container :
- Take the default.conf file as a base
- Find the line starting by
fastcgi_param PHP_VALUE [...]
- Add a new line and set your new parameter
- Mount your new file to
/etc/nginx/nginx.conf