Created
April 24, 2019 16:19
-
-
Save Trshant/e06bebd178915a7a025339c4bd5e5d94 to your computer and use it in GitHub Desktop.
docker setup for LAMP
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
version: '3' | |
services: | |
# we named our first service 'web' | |
web: | |
# build a custom image | |
build: | |
context: . | |
dockerfile: ./Dockerfile | |
# a name for easier reference | |
image: php_host | |
# map host port 8080 to container port 80 | |
ports: | |
- 8080:80 | |
# volumes are like shared folders | |
# container will see your local code changes | |
volumes: | |
- ./src:/var/www/html | |
# first load the 'db' service | |
depends_on: | |
- db | |
# make 'db' a known service/host inside of 'web' | |
# use this to make a mysql connection to host 'db' | |
links: | |
- db | |
db: | |
# use a default image | |
image: mysql:5.7 | |
# again, port mapping | |
# e.g. to use workbench | |
ports: | |
- 13306:3306 | |
# the mysql image uses these to create database and users | |
environment: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: bolt | |
MYSQL_USER: bolt | |
MYSQL_PASSWORD: password | |
MYSQL_HOST: |
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
FROM php:7.3-apache | |
LABEL maintainer="[email protected]" | |
# Install PHP extensions and PECL modules. | |
RUN buildDeps=" \ | |
default-libmysqlclient-dev \ | |
libbz2-dev \ | |
libmemcached-dev \ | |
libsasl2-dev \ | |
" \ | |
runtimeDeps=" \ | |
curl \ | |
git \ | |
libfreetype6-dev \ | |
libicu-dev \ | |
libjpeg-dev \ | |
libldap2-dev \ | |
libmemcachedutil2 \ | |
libpng-dev \ | |
libpq-dev \ | |
libxml2-dev \ | |
libzip-dev \ | |
" \ | |
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y $buildDeps $runtimeDeps \ | |
&& docker-php-ext-install bcmath bz2 calendar iconv intl mbstring mysqli opcache pdo_mysql pdo_pgsql pgsql soap zip \ | |
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | |
&& docker-php-ext-install gd \ | |
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ | |
&& docker-php-ext-install ldap \ | |
&& docker-php-ext-install exif \ | |
&& pecl install memcached redis \ | |
&& docker-php-ext-enable memcached.so redis.so \ | |
&& apt-get purge -y --auto-remove $buildDeps \ | |
&& rm -r /var/lib/apt/lists/* \ | |
&& a2enmod rewrite | |
# Install Composer. | |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ | |
&& ln -s $(composer config --global home) /root/composer | |
ENV PATH=$PATH:/root/composer/vendor/bin COMPOSER_ALLOW_SUPERUSER=1 | |
COPY src/ /var/www/html/ | |
EXPOSE 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment