local dev environment using docker containers, defined in docker-compose

Mark Lightfoot a5d7c070b9 initial 5 anos atrás
db a5d7c070b9 initial 5 anos atrás
src a5d7c070b9 initial 5 anos atrás
README.md a5d7c070b9 initial 5 anos atrás
docker-compose.yaml a5d7c070b9 initial 5 anos atrás

README.md

Docker-compose example

This is a quick example that allows live development on a server. This is very basic and lacks a number of features that would be on an average site (eg fastcgi, redis, etc).

It is accessible on localhost:80

db folder

  • Contains create_database.sql

This is standard sql to create a database to work off. In the example of cloudM, you'd have an SQL dump or such here to populate the DB. This is referenced in docker-compose.yaml

volumes:
      - "./db/:/docker-entrypoint-initdb.d"

With the specific image used (mysql:5.7) anything placed in the container at docker-entrypoint-initdb.d will be ran as sql files when the database has been created.

src

Code lives here. The example here is a simple php file to pull some data from the DB and display it. it is mounted in the docker-compose.yaml so thus can edited on-the-fly without restarts.

docker-compose.yaml

defines how everything meshes together. run the command docker-compose up to bring it all live, with down to tear it away.

    build: 
      context: .
      dockerfile: web-dockerfile

This defines that the image will be built from a file within the current directory, with web-dockerfile being the Dockerfile.

web-dockerfile

Creates the docker image. It uses an image from the dockerhub, updates and then enables the mysqli module for php to allow connections. The command `docker-php-ext-install X' is provided by the creators of the docker image.