Sign inSign up

rhuruphansen/laravel

By rhuruphansen

•Updated 2 months ago

Laravel docker container

Image
Web servers
0

2.9K

rhuruphansen/laravel repository overview

⁠Laravel docker image

Image based on Ubuntu 22.04 (5.15.49-linuxkit-pr) for running Laravel application with

  • Apache version 2.4.52 (Ubuntu)
  • PHP version 8.1.22 - FPM - (Ubuntu).
  • Composer version 2.5.8.
  • Horizon (Managed by supervisord).

⁠Version History:

---- Version 0.4
Added laravel environment variables to docker-compose.yaml
See below which 

⁠Docker shortcuts:

Terminate horizon (starts again within 1-2 sec):

docker exec laravel php artisan horizon:terminate

⁠Apache Modules enabled

 - env 
 - headers 
 - proxy 
 - proxy_http 
 - proxy_fcgi 
 - rewrite

⁠PHP Modules enabled

 - php8.2-fpm, php8.2-gd, php8.2-mbstring, php8.2-mcrypt, php8.2-apcu, php8.2-ssh2
 - php8.2-memcache, php8.2-uuid, php8.2-memcached, php8.2-bcmath, php8.2-gnupg, php8.2-intl
 - php8.2-mongodb, php8.2-readline, php8.2-redis, php8.2-cgi, php8.2-mysql, php8.2-rrd
 - php8.2-xml, php8.2-cli, php8.2-oauth, php8.2-xmlrpc, php8.2-imagick, php8.2-xsl, php8.2-dev
 - php8.2-curl, php8.2-imap, php8.2-opcache, php8.2-soap, php8.2-yaml, php8.2-sqlite3, php8.2-zip
⁠Environment variables
version: "1"
services:
  laravel:
    container_name: laravel_app
    image: rhuruphansen/laravel:latest
    restart: always
    environment:
      - SHELL_STARTUP_SCRIPT=deploy.sh # Default deploy file
      - LARAVEL_ENABLED=true # Enableing Laravel vhost file (For using /public folder)
      - LARAVEL_CRON_ENABLED=true # Default true
      - LARAVEL_HORIZON_ENABLED=false # Default true (Enableing horizon (supervisord))
      - LARAVEL_HORIZON_THREADS=4 # Number of PHP Processing threads Horizon runs. Default 2
      - LARAVEL_APP_ENV=local # Default local (Horizon is accessible)
      - LARAVEL_APP_URL="http://localhost" # Default http://localhost (Horizon is accessible)
      - LARAVEL_APP_TIMEZONE="Europe/Copenhagen" # Default Europe/Copenhagen (Where i live)
      - LARAVEL_APP_KEY="base64:EPzoHyjAH0ST8iOQ8cRDnPiG4UUXRh16T6WYnFI5rZE=" # Default NONE !!!! (Required!)
      - LARAVEL_APP_DEBUG=true # Default false
      - LARAVEL_DB_CONNECTION=sqlite # Default mysql
      - LARAVEL_DB_HOST=/var/www/database.sqlite # Required
      - LARAVEL_DB_PORT=3306 # Required
      - LARAVEL_DB_DATABASE=laravel_database # Required
      - LARAVEL_DB_USERNAME=laravel_username # Required
      - LARAVEL_DB_PASSWORD=laravel_password # Requiredπ
      - LARAVEL_REDIS_HOST=redis
      - LARAVEL_REDIS_PORT=6379
      - LARAVEL_REDIS_PASSWORD=null
    volumes:
      - "./www:/var/www/:rw"
    ports:
      - "80:8080"
⁠docker-compose.yml
version: "1"
services:
  laravel:
    container_name: laravel
    image: rhuruphansen/laravel:latest
    restart: always
    volumes:
      - "./laravel_app:/var/www/:rw"
    ports:
      - "80:8080"
⁠docker-compose.yml with Redis / MySQL
version: "1"
services:
  laravel:
    container_name: laravel_app
    image: rhuruphansen/laravel:latest
    restart: always
    volumes:
      - "./www:/var/www/:rw"
    ports:
      - "80:8080"
    networks:
      backend_laravel:
        aliases:
          - app
  laravel_db:
    image: mysql:8.0.33
    container_name: laravel_db
    restart: always
    volumes:
      - ./mysql/run/var:/var/lib/mysql
    ports:
      - "3307:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=db_password
      - MYSQL_DATABASE=db_database
      - MYSQL_USER=db_username
      - MYSQL_PASSWORD=db_password
    networks:
      backend_laravel:
        aliases:
          - db
  laravel_redis:
    image: redis
    container_name: laravel_redis
    volumes:
      - ./redis/conf:/usr/local/etc/redis
    networks:
      backend_laravel:
        aliases:
          - redis
networks:
  backend_laravel:
    name: network_laravel

Tag summary

Content type

Image

Digest

sha256:fe01144c4…

Size

432.4 MB

Last updated

2 months ago

docker pull rhuruphansen/laravel