GithubHelp home page GithubHelp logo

trompx / docker-nginx-laravel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tecknix/docker-nginx-laravel

0.0 2.0 0.0 144 KB

An Ubuntu, Nginx and PHP/Laravel stack Built in Docker

Shell 100.00%

docker-nginx-laravel's Introduction

Docker: Ubuntu, Nginx and PHP Stack

This is the basis for LEMP stack (minus MySQL). This is based on phusion/baseimage-docker base Ubuntu image, which takes care of system issues which Docker's base Ubuntu image does not take care of, such as watching processes, logrotate, ssh server, cron and syslog-ng.

You can build this yourself after cloning the project (assuming you have Docker installed).

cd /path/to/repo/docker-nginx-laravel
docker build -t webapp . # Build a Docker image named "webapp" from this location "."
# wait for it to build...

# Run the docker container
docker run -v /path/to/local/web/files:/var/www:rw -p 80:80 -d webapp /sbin/my_init --enable-insecure-key

On a Mac, Docker only shares the /Users folder, so adding your project to the /Users/<current_user>/Public/ dir is a good idea.

This will bind local port 80 to the container's port 80. This means you should be able to go to "localhost" in your browser (or the IP address of your virtual machine oh which Docker is running) and see your web application files.

  • docker run - starts a new docker container
  • -v /path/to/local/web/files:/var/www:rw - Bind a local directory to a directory in the container for file sharing. rw makes it "read-write", so the container can write to the directory.
  • -p 80:80 - Binds the local port 80 to the container's port 80, so local web requests are handled by the docker.
  • -P - Alternatively, binds any required network ports inside our container to our host, so local web requests are handled by the docker and you can connect to the pgsql.
  • -d webapp - Use the image tagged "webapp"
  • /sbin/my_init - Run the init scripts used to kick off long-running processes and other bootstrapping, as per phusion/baseimage-docker
  • --enable-insecure-key - Enable a generated SSL key so you can SSH into the container, again as per phusion/baseimage-docker. Generate your own SSH key for production use.
  • If you use this with fideloper/docker-mysql, then link this container with MySQL's (after running the MySQL container first) via -link mysql:db - This container assumes the use of SQLite as your DB of choice

Compiler is included in this image, along with the binary for Laravel. This allows you to login to the container:

docker ps -a
# Get the Container id
docker exec -t -i <docker-id> /bin/bash

# Once at the command line
cd /var/www/
laravel new <project-name>

Don't forget to change the permissions on your storage folder for logs and Laravel specific cache to be created

 chmod -R og+rw storage

This build was inspired by the Dockerfile of Chris Fidao - fideloper

docker-nginx-laravel's People

Contributors

aranw avatar betobe avatar fideloper avatar m00dy avatar tecknix 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.