Skip to content

docker with frankenphp installation

Benjamin Jonard edited this page Jun 8, 2024 · 5 revisions

Using Docker with FrankenPHP (experimental)

This image can have improved performances, but at the cost of higher memory usage

See Configuration section for details on the different configuration options available and their values.

See https://frankenphp.dev/ for more details on FrankenPHP

Step 1 -> Create a docker-compose.yml file

version: '3'

services:
    # Koillection
    koillection:
        image: koillection/koillection:frankenphp
        container_name: koillection
        restart: unless-stopped
        ports:
            - "80:80"
            - "443:443"
            - "443:443/udp"
        env_file:
            - .env
        depends_on:
            - db
        volumes:
            - ./volumes/koillection/uploads:/uploads

    # Database : choose one of the following
    db:
        image: postgres:16
        container_name: db
        restart: unless-stopped
        env_file:
            - .env
        environment:
            - POSTGRES_DB=${DB_NAME}
            - POSTGRES_USER=${DB_USER}
            - POSTGRES_PASSWORD=${DB_PASSWORD}
        volumes:
            - "./volumes/postgresql:/var/lib/postgresql/data"

    #db:
    #    image: mysql:latest
    #    container_name: db       
    #    restart: unless-stopped 
    #    environment:
    #        - MYSQL_DATABASE=${DB_NAME}
    #        - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
    #    volumes:
    #        - "./docker/volumes/mysql:/var/lib/mysql"

Step 2 -> Create a .env file

########################################################################################################
#                                                WEB
#
# APP_DEBUG=1 displays detailed error message
#
# APP_SECRET is a random string used for security, you can use for example openssl rand -base64 21
# APP_SECRET is automatically generated when using Docker
#
# PHP_TZ, see possible values here https://www.w3schools.com/php/php_ref_timezones.asp
########################################################################################################

APP_DEBUG=0
APP_ENV=prod
#APP_SECRET=

HTTPS_ENABLED=1
UPLOAD_MAX_FILESIZE=20M
PHP_MEMORY_LIMIT=512M
PHP_TZ=Europe/Paris


########################################################################################################
#                                                API
#
#
# JWT_PASSPHRASE is a random string used for security, you can use for example openssl rand -base64 21
# JWT_PASSPHRASE is automatically generated when using Docker
########################################################################################################

CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
#JWT_PASSPHRASE=

########################################################################################################
#                                                DATABASE
########################################################################################################

DB_DRIVER=pdo_pgsql
DB_NAME=koillection
DB_HOST=db
DB_PORT=5432
DB_USER=koillection
DB_PASSWORD=change_me!
DB_VERSION=16

########################################################################################################
#                                                FRANKENPHP
#
# FRANKENPHP_CONFIG Path to the public/index.php file. Should NOT be changed when using Docker
# FRANKENPHP_SERVER_NAME Your domain, for example: mysubdomain.exemple.com, localhost, :80. Defaults to :80
########################################################################################################

#FRANKENPHP_CONFIG=
FRANKENPHP_SERVER_NAME=':80'

Step 3 -> Review both files and update values if required

Step 4 -> Start Koillection

docker-compose up -d