GithubHelp home page GithubHelp logo

samhwang / docker-php-template Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 39 KB

My PHP & Docker template for starting up a new PHP 7 project.

License: MIT License

Dockerfile 28.15% PHP 71.85%
docker php

docker-php-template's Introduction

My Docker PHP Project Template

GitHub

Basically a boilerplate to setup a PHP7 project with common tools such as Composer and PHPUnit and a Docker container environment setup. From that point, it can be a project on its own or running as a backend service in a microservices configuration.

Requirements

  • PHP >= 7.4
  • Composer >= 1.9
  • Docker & docker-compose

Usage in future projects

  • Clone the project.
  • Run the composer setup command.
git clone [email protected]:samhwang/docker-php-template.git [YOUR_PROJECT_DIRECTORY]
cd [YOUR_PROJECT_DIRECTORY]
composer run setup

Building the development image

docker-compose build

Upon building the image, it will check if there already exists a pair of SSL key files and certificate. If not, it will generate one. To generate your own pair of self-signed SSL keys, you can run:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout .docker/ssl/server.key -out .docker/ssl/server.crt

Building the production image

docker-compose -f docker-compose.yml -f docker-compose.prod.yml build
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up --remove-orphans

Composing the network

To run the image and connect it with the rest of the network (including Database, Mailhog and Adminer), you will need to create your own .env file. A sample is provided as .env.sample. And then you can run these commands:

# Add -d to run detached
# Add --build to rebuild the image
docker-compose [-d --build] up

# These two ports are set to bind to port 40 and 443 in the docker-compose.yml file.
curl http://localhost:80
curl https://localhost:443

docker-php-template's People

Contributors

samhwang avatar

Watchers

 avatar  avatar  avatar

docker-php-template's Issues

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.