Docker with Laravel 11, Filament 3
Hello, i need docker compose for Laravel 11 with Filament 3
I make few containers but it doesn't work.
Can someone send me some sources or config files or other type of help? ๐
6 Replies
@Konaล have you looked into Laravel Sail? It generates a docker-compose.yml (for development).
Filament should work with every Laravel docker setup
This works for me.
Dockerfile
opcache.ini
docker-compose.yml
In the same directory you have to create a
FROM php:8.3-apache
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
RUN apt update && apt upgrade -y
RUN apt install -y libicu-dev libxslt-dev libxml2-dev zlib1g-dev libpng-dev libonig-dev libldap-dev libldap-common libsqlite3-dev libzip-dev
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl && \
docker-php-ext-install opcache && \
docker-php-ext-install exif && \
docker-php-ext-install gettext && \
docker-php-ext-install mbstring && \
docker-php-ext-install gd && \
docker-php-ext-install xsl && \
docker-php-ext-install zip && \
docker-php-ext-install soap && \
docker-php-ext-install ldap && \
docker-php-ext-install mysqli && \
docker-php-ext-install pdo pdo_mysql pdo_sqlite
RUN a2enmod headers && \
a2enmod ssl && \
a2enmod rewrite
FROM php:8.3-apache
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
RUN apt update && apt upgrade -y
RUN apt install -y libicu-dev libxslt-dev libxml2-dev zlib1g-dev libpng-dev libonig-dev libldap-dev libldap-common libsqlite3-dev libzip-dev
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl && \
docker-php-ext-install opcache && \
docker-php-ext-install exif && \
docker-php-ext-install gettext && \
docker-php-ext-install mbstring && \
docker-php-ext-install gd && \
docker-php-ext-install xsl && \
docker-php-ext-install zip && \
docker-php-ext-install soap && \
docker-php-ext-install ldap && \
docker-php-ext-install mysqli && \
docker-php-ext-install pdo pdo_mysql pdo_sqlite
RUN a2enmod headers && \
a2enmod ssl && \
a2enmod rewrite
[opcache]
opcache.enable=1
; 0 means it will check on every request
; 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production
opcache.revalidate_freq=0
opcache.validate_timestamps=1
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.max_wasted_percentage=10
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1
[opcache]
opcache.enable=1
; 0 means it will check on every request
; 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production
opcache.revalidate_freq=0
opcache.validate_timestamps=1
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.max_wasted_percentage=10
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1
services:
app-data:
image: 'mysql/mysql-server:8.0'
container_name: app-data
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: '__DB_ROOT_PASSWORD__'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: 'db_name'
MYSQL_USER: 'db_user'
MYSQL_PASSWORD: '__DB_PASSWORD__'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- ./dump:/docker-entrypoint-initdb.d
- dbdata:/var/lib/mysql
command: --sql_mode=""
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-p__DB_ROOT_PASSWORD__'
retries: 3
interval: 5s
timeout: 5s
app-source:
build: .
container_name: app-source
ports:
- '80:80'
- '443:443'
env_file:
- .env.development
volumes:
- ./src:/var/www/html
depends_on:
- app-data
volumes:
dbdata:
driver: local
driver_opts:
type: none
device: ./db_data
o: bind
services:
app-data:
image: 'mysql/mysql-server:8.0'
container_name: app-data
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: '__DB_ROOT_PASSWORD__'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: 'db_name'
MYSQL_USER: 'db_user'
MYSQL_PASSWORD: '__DB_PASSWORD__'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- ./dump:/docker-entrypoint-initdb.d
- dbdata:/var/lib/mysql
command: --sql_mode=""
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-p__DB_ROOT_PASSWORD__'
retries: 3
interval: 5s
timeout: 5s
app-source:
build: .
container_name: app-source
ports:
- '80:80'
- '443:443'
env_file:
- .env.development
volumes:
- ./src:/var/www/html
depends_on:
- app-data
volumes:
dbdata:
driver: local
driver_opts:
type: none
device: ./db_data
o: bind
.env.development
file with your own environment variables
And all your application files inside a src
folderJust use herd.... ๐
How is this helpful in if you want/need docker?
@undercode github link please.