Giter VIP home page Giter VIP logo

docker-skeleton-lemp's Introduction

Docker LEMP + PhpMyAdmin

Simple docker environment that allows you to run applications such as Symfony Laravel or any custom PHP-like project.

This LEMP + composer stack also includes PhpMyAdmin to allow you to manipulate your data even easier.

It is also shipped with vim, nano, curl, and many more useful tools!

Symfony installation guide ๐Ÿ”ฅ| Laravel installation guide ๐Ÿš€

Check the Wiki for further explanation.

Do you want to help us improve the environment or did you found a bug? Let us know.


Environment setup

  1. Clone the repository:

    git clone https://github.com/Josee9988/Docker-Skeleton-LEMP.git
  2. Go to the cloned project directory:

    cd Docker-Skeleton-LEMP
  3. Modify the .env environment variables as you please.

    ###> Docker-Skeleton-LEMP-Config ###
    MYSQL_DATABASE=skeletondb
    MYSQL_USER=dev
    MYSQL_PASSWORD=1234
    MYSQL_ROOT_PASSWORD=root
    HTTP_PORT=80
    PHPMYADMIN_PORT=9000
    MYSQL_PORT=3306
    APPLICATION_NAME=skeletonApp
    ###> Docker-Skeleton-LEMP-Config ###
  4. Build and test the container is successfully working

    docker-compose up -d
    • When you are done, visit the test page on the following URL: http://localhost NOTE: If you change the 'HTTP_PORT' you will have to specify the port at the end of the URL.
    • Visit the PhpMyAdmin page at: http://localhost:9000 and log in: (root/root or dev/1234)
  5. Initialize your Symfony/Laravel/PHP app.

    • Copy the 'Docker-Skeleton-LEMP-Config' .env config to your clipboard to not lose your configuration.
    • Create/copy your new Symfony/Laravel/PHP files keeping the /docker/ directory and the docker-compose.yaml file.
    • Add the 'Docker-Skeleton-LEMP-Config' .env config in your new .env file.

Default port settings

Service Port Path
Nginx (Your App) 80 http://localhost
PhpMyAdmin 9000 http://localhost:9000
MySQL 3306 N/A

Connect with the terminal to run commands inside the container

If you want to run a specific composer or MySQL commands or any kind of command inside the container you can easily do it with:

NOTE: 'skeletonApp' is the default application name. If you change this value in the .env file make sure to run the commands with your own project name.

  • Access MySQL terminal.
docker exec -it skeletonApp-mysql bash # to access MySQL CLI
  • Access composer, and your own project.
docker exec -it skeletonApp-phpfpm bash # to run any other command inside the container

Project tree

.
โ”œโ”€โ”€ docker
โ”‚ย ย  โ”œโ”€โ”€ Dockerfile
โ”‚ย ย  โ”œโ”€โ”€ mysql
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ mysql-data
โ”‚ย ย  โ”œโ”€โ”€ nginx
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ default.conf
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ logs
โ”‚ย ย  โ””โ”€โ”€ php
โ”‚ย ย      โ”œโ”€โ”€ logs
โ”‚ย ย      โ””โ”€โ”€ php-ini-overrides.ini
โ”œโ”€โ”€ docker-compose.yaml
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ public
โ”‚ย ย  โ”œโ”€โ”€ index.php
โ”‚ย ย  โ””โ”€โ”€ README.md
โ””โ”€โ”€ README.md

Restart (MySQL) settings/container

If you should your MySQL environment variables you will have to re-create the docker container.

  • Remove all the MySQL data

    sudo rm -rfv docker/mysql/mysql-data/ && mkdir -p docker/mysql/mysql-data
  • Recreate the container

    docker-compose up -d --build --force-recreate # will rebuild the container.
  • Then, you can restart you can re-run your app as normal.

    docker-compose up -d

Did you enjoy the environment? Help us raise these numbers up!

Github followers Github stars Github watchers Github forks


โš ๏ธRemember that this docker environment does not guarantee a 100% effectiveness as it is being tested yet, and may have some issue at some point. Use it at your own risk and always do backups of your code.โš ๏ธ

Made with a lot of โค๏ธโค๏ธ by @Josee9988

docker-skeleton-lemp's People

Contributors

josee9988 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.