An PHP 8.3 docker image for running your laravel filament application or your any PHP application
2.2K
An docker image to run your laravel filament application, not only that. This image can be used in your regulary laravel application (without filament) or your any PHP application. This image can only be used within the Dockerfile only. Please follow this documentation to use
This is the image specification are used
services:
laravel-filament-web:
container_name: laravel-filament-web
build:
context: .
dockerfile: Dockerfile
volumes:
- ./public:/var/www/html
- .:/var/www
networks:
- laravel-filament
ports:
- 7271:80
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/up"]
interval: 30s
timeout: 10s
retries: 5
env_file:
- .env
networks:
laravel-filament:
driver: bridge
if you want to plan use a queue, you can modify the docker-compose.yml below
services:
laravel-filament-web:
container_name: laravel-filament-web
build:
context: .
dockerfile: Dockerfile
volumes:
- ./public:/var/www/html
- .:/var/www
networks:
- laravel-filament
ports:
- 7271:80
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/up"]
interval: 30s
timeout: 10s
retries: 5
env_file:
- .env
laravel-filament-queue:
container_name: laravel-filament-queue
image: teguh02/php83-oci8-mysql-psql-big-upload-no-webserver
volumes:
- .:/var/www/html
command: >
sh -c "composer install && php artisan queue:listen --timeout=0 --tries=3"
networks:
- laravel-filament
env_file:
- .env
restart: unless-stopped
depends_on:
- laravel-filament-web
networks:
laravel-filament:
driver: bridge
# Define the base image
FROM teguh02/laravel-filament:latest
# Set user to root
USER root
# Change the working directory
WORKDIR /var/www
# Remove the all files in the /var/www/html directory
RUN rm -rf /var/www/html/*
# Copy laravel public directory to the /var/www/html directory
COPY ./public /var/www/html
# Copy the project files to the /var/www directory
COPY . /var/www
# Install the project dependencies
RUN composer install
RUN npm install
# Build the vite
RUN npm run build
# Change the directory permission
RUN chmod -R 777 /var/www
# If you want to change the timezone of the container to UTC
# RUN sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/8.3/fpm/php.ini
# RUN sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/8.3/cli/php.ini
# If you want to display the error message
RUN sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/8.3/fpm/php.ini
RUN sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/8.3/cli/php.ini
RUN sed -i 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/g' /etc/php/8.3/fpm/php.ini
services:
php-web:
container_name: php-web
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/var/www/html
networks:
- php-web
ports:
- 7271:80
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
retries: 5
# env_file: # UnComment this if needed
# - .env
networks:
php-web:
driver: bridge
# Define the base image
FROM teguh02/laravel-filament:latest
# Set user to root
USER root
# Change the working directory
WORKDIR /var/www/html
# Remove the all files in the /var/www/html directory
RUN rm -rf /var/www/html/*
# Copy the project files to the /var/www/html directory
COPY . /var/www/html
# Install the project dependencies (optional)
# RUN composer install
# RUN npm install
# Build the vite (optional)
# RUN npm run build
# Change the directory permission
RUN chmod -R 777 /var/www
# If you want to change the timezone of the container to UTC
# RUN sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/8.3/fpm/php.ini
# RUN sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/8.3/cli/php.ini
# If you want to display the error message
RUN sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/8.3/fpm/php.ini
RUN sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/8.3/cli/php.ini
RUN sed -i 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/g' /etc/php/8.3/fpm/php.ini
Finaly! run the docker-compose.yml use
docker compose up --build -d
or if you save the docker-compose.yml with another name, for example
docker compose -f docker-compose.dev.yml up --build -d
Now open your project in http://localhost:7271. You can adjust the port with your own needs
Content type
Image
Digest
sha256:8bcba1d04…
Size
568.1 MB
Last updated
almost 2 years ago
docker pull teguh02/laravel-filament