Luca Parolari <luca.parolari23@gmail.com>.
For now, I will not explain all the things on docker. This memo is thought to integrate docker in a project with the minimal number of steps.
Docker is a mechanism used to create isolated environment without setting up a virtual machine.
Docker uses a Dockerfile
to get the informations of how the environment is. There you can specify all the options of the "venv", setting up parameters and decide what will the environment has to contain.
The dockerfile can be like this
FROM php:7.2-apache
MAINTAINER Luca Parolari
COPY . /srv/app
COPY .docker/php/vhost.conf /etc/apache2/sites-available/000-default.conf
EXPOSE 80
RUN chown -R www-data:www-data /srv/app && a2enmod rewrite
To run the environment, it must be built.
docker build --file .docker/php/Dockerfile -t php-lapieve-docker .
docker run --rm -p 8080:80 php-lapieve-docker
Docker-Compose is an extension of docker that allows to build and run docker in the composer style.
Create a docker-compose.yml
like this
version: '3'
services:
app:
build:
context: .
dockerfile: .docker/php/Dockerfile
image: php-lapieve-docker
ports:
- 8080:80
volumes:
- ./:/srv/app
docker-compose up