Last active
May 18, 2024 09:24
-
-
Save jswebschmiede/a0c94dedbd0670ec804511adead85ce0 to your computer and use it in GitHub Desktop.
PHP Environment with Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
web: | |
image: nginx:alpine | |
restart: unless-stopped | |
ports: | |
- 80:80 | |
volumes: | |
- ./nginx/nginx.conf:/etc/nginx/nginx.conf | |
- ./app:/home/develop/www/app | |
networks: | |
- web | |
php: | |
image: my-php | |
build: services/php | |
volumes: | |
- ./app:/home/develop/www/app | |
user: '1000:1000' | |
networks: | |
- web | |
extra_hosts: | |
- 'host.docker.internal:host-gateway' | |
db: | |
image: mariadb:latest | |
restart: unless-stopped | |
env_file: | |
- ./.env | |
volumes: | |
- mysqldata:/var/lib/mysql | |
ports: | |
- 3306:3306 | |
networks: | |
- web | |
phpmyadmin: | |
image: 'phpmyadmin:latest' | |
ports: | |
- 8080:80 | |
networks: | |
- web | |
environment: | |
- PMA_ARBITRARY=1 | |
- PMA_HOST=db | |
depends_on: | |
- db | |
volumes: | |
mysqldata: {} | |
networks: | |
web: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Dockerfile needs to be in folder /services/php | |
FROM php:fpm | |
RUN groupadd -g 1000 develop && \ | |
useradd -u 1000 -g 1000 -m develop | |
RUN apt-get update && \ | |
apt-get install -y zip libzip-dev libmagickwand-dev zlib1g-dev libpng-dev libjpeg-dev --no-install-recommends && \ | |
rm -rf /var/lib/apt/lists/* | |
RUN docker-php-ext-configure zip | |
RUN docker-php-ext-configure gd --with-jpeg | |
RUN mkdir -p /usr/src/php/ext/imagick; \ | |
curl -fsSL https://github.com/Imagick/imagick/archive/06116aa24b76edaf6b1693198f79e6c295eda8a9.tar.gz | tar xvz -C "/usr/src/php/ext/imagick" --strip 1 && \ | |
docker-php-ext-install gd imagick pdo pdo_mysql zip; | |
USER develop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
worker_connections 4096; ## Default: 1024 | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
keepalive_timeout 65; | |
server { | |
listen 80; | |
server_name php.local; | |
root /home/develop/www/app/public; | |
index index.php index.html; | |
location / { | |
autoindex on; | |
} | |
location ~ \.php$ { | |
fastcgi_pass php:9000; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment