Skip to content

Instantly share code, notes, and snippets.

@System-Glitch
Last active September 18, 2023 04:48

Revisions

  1. System-Glitch revised this gist Dec 16, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -26,8 +26,8 @@ services:
    image: mariadb
    environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: digitick
    MYSQL_USER: digitick
    MYSQL_DATABASE: db_name
    MYSQL_USER: db_user
    MYSQL_PASSWORD: secret
    networks:
    - backend
  2. System-Glitch created this gist Dec 8, 2019.
    32 changes: 32 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    FROM php:7.2-fpm

    RUN apt-get update && apt-get install -y \
    git \
    zip \
    curl \
    sudo \
    unzip \
    libicu-dev \
    libbz2-dev \
    libpng-dev \
    libjpeg-dev \
    libmcrypt-dev \
    libreadline-dev \
    libfreetype6-dev

    RUN docker-php-ext-install \
    bz2 \
    intl \
    iconv \
    bcmath \
    opcache \
    calendar \
    mbstring \
    pdo_mysql \
    zip

    COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

    CMD ["sh", "-c", "chown -R www-data:www-data /var/www/html/storage && cd /var/www/html && composer install && php artisan key:generate && php-fpm"]

    EXPOSE 9000
    43 changes: 43 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    version: '3'
    services:
    php:
    build: .
    networks:
    - backend
    expose:
    - "9000"
    volumes:
    - .:/var/www/html
    nginx:
    image: nginx:mainline-alpine
    networks:
    - backend
    ports:
    - '8080:8080'
    restart: on-failure
    volumes:
    - .:/var/www/html
    - ./nginx_config.conf:/etc/nginx/conf.d/site.conf
    links:
    - php
    depends_on:
    - php
    mariadb:
    image: mariadb
    environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: digitick
    MYSQL_USER: digitick
    MYSQL_PASSWORD: secret
    networks:
    - backend
    ports:
    - '3306:3306'
    restart: on-failure
    volumes:
    - databaseVolume:/var/lib/mysql
    volumes:
    databaseVolume: {}
    networks:
    backend:
    driver: bridge
    23 changes: 23 additions & 0 deletions nginx_config.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    server {
    listen 8080 default_server;
    listen [::]:8080 default_server;
    index index.php;
    server_name digitick.local;
    error_log /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www/html/public;

    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass php:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }

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