Skip to content

Commit

Permalink
Merge pull request #16 from toyrik/master
Browse files Browse the repository at this point in the history
docker для бека
  • Loading branch information
toyrik authored Apr 3, 2024
2 parents f935de1 + 4999765 commit 5ef1f87
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ yarn-error.log
/.fleet
/.idea
/.vscode
/db

# ide helper
/.phpstorm.meta.php
Expand Down
52 changes: 52 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: '3'

services:

nginx:
build:
context: ./docker
dockerfile: nginx.docker
volumes:
- ./:/app
depends_on:
- php-fpm
ports:
- '8000:8000'

php-fpm:
build:
context: ./docker
dockerfile: php-fpm.docker
volumes:
- ./:/app

php-cli:
build:
context: ./docker
dockerfile: php-cli.docker
volumes:
- ./:/app
- composer:/root/.composer/cache

mysql:
image: mariadb:10.4
ports:
- '3366:3306'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: app
MYSQL_USER: user
MYSQL_PASSWORD: password
volumes:
- ./db/mariadb:/var/lib/mysql


adminer:
image: adminer
ports:
- '8880:8080'
environment:
ADMINER_DEFAULT_SERVER: mysql

volumes:
composer:
5 changes: 5 additions & 0 deletions docker/nginx.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:1.25-alpine

COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf

WORKDIR /app
18 changes: 18 additions & 0 deletions docker/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {
listen 8000;
index index.php index.php;
root /app/public;

location / {
try_files $uri /index.php?$args;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
14 changes: 14 additions & 0 deletions docker/php-cli.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:8.1-cli

RUN apt-get update && apt-get install -y libpq-dev zlib1g-dev zip

RUN docker-php-ext-install \
pdo \
pdo_mysql \
mysqli

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer --quiet

ENV COMPOSER_ALLOW_SUPERUSER 1

WORKDIR /app
8 changes: 8 additions & 0 deletions docker/php-fpm.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM php:8.2-fpm

RUN docker-php-ext-install \
pdo \
pdo_mysql \
mysqli

WORKDIR /app

0 comments on commit 5ef1f87

Please sign in to comment.