Skip to content

Instantly share code, notes, and snippets.

@0hsn
Last active May 2, 2019 02:47
Show Gist options
  • Save 0hsn/81381a36f68aa464513f0648c0c4fc78 to your computer and use it in GitHub Desktop.
Save 0hsn/81381a36f68aa464513f0648c0c4fc78 to your computer and use it in GitHub Desktop.
Docker starter for Lumen.

Docker starter for Lumen.

This version is tested with Lumen 5.8

About

Docker starter for Lumen comprised of 2 files: docker-composer.yml and Dockerfile. Debian 9 (stretch) is used to build the app box. App box contains: php 7.3, apache 2.4, and nodejs 12.x. composer is also available in it.

How to use:

  1. Install lumen with composer in your host machine
  2. put these file where .env files are
  3. docker-compose up -d --build to start the machine
version: '3.7'
services:
db:
image: mysql:5.7
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: budget_db
MYSQL_ROOT_PASSWORD: rootp
app:
build: .
working_dir: /var/www/html
env_file:
- .env
ports:
- "80:80"
volumes:
- .:/var/www/html
depends_on:
- db
phpmyadmin:
image: phpmyadmin/phpmyadmin:4.7
ports:
- "81:80"
depends_on:
- db
FROM debian:stretch
RUN apt-get update --fix-missing && apt-get upgrade -y && apt-get install -y \
vim build-essential gcc curl wget make lsb-release apt-transport-https ca-certificates
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php7.3.list
RUN apt-get update --fix-missing
RUN apt-get -y install php7.3 \
php7.3-cli php7.3-fpm php7.3-json php7.3-pdo php7.3-mysql php7.3-zip php7.3-gd php7.3-mbstring \
php7.3-curl php7.3-xml php7.3-bcmath php7.3-json libapache2-mod-php7.3 \
apache2 apache2-utils
RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sSL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN useradd --create-home -s /bin/bash default
ENV APACHE_DOCUMENT_ROOT /var/www/html/public/
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
RUN sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
RUN sed -i "s#/var/www/html#/var/www/html/public#g" /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite headers
COPY . /var/www/html/
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment