GithubHelp home page GithubHelp logo

bartwesselink / symfony-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from recognizegroup/symfony-docker

0.0 1.0 0.0 50 KB

Docker image tailed to run symfony application

License: MIT License

Shell 1.39% Dockerfile 98.61%

symfony-docker's Introduction

symfony-docker

Docker image tailed to run symfony application. Check https://hub.docker.com/r/recognizebv/symfony-docker

What's here?

This repository is a source code for following docker images that allow relatively easily work with symfony php framework.

What is the concept here?

You use php-dev images to develop by mounting your local directory into machine. You use non-dev images to copy app code into image and then deploy your application to stage/live environments.

What is the difference between php* and php*-dev?

Non dev images are intended to be used in production. Dev images have xdebug installed additionally, so you can use it for debugging.

Usage

Development env with docker-compose.yml

You can you this docker-compose.yml file to develop:

www:
  image: recognizebv/symfony-docker:php7.1-dev
  volumes:
    - ".:/var/www/html"
  ports:
    - "80:80"

Of course you are free to add linked containers like database, caching etc.

Adjust your symfony app kernel to write cache and logs to /tmp dir

    public function getCacheDir()
    {
        return sys_get_temp_dir().'/cache/'.$this->getEnvironment();
    }

    public function getLogDir()
    {
        return sys_get_temp_dir().'/logs/'.$this->getEnvironment();
    }

Use docker-compose up command to start your development environment.

Output logs to stderr (optional)

You may want to adjust config_dev and config_prod to output logs to stderr (so they will be handled correctly by docker) path: "php://stderr"

Build production image

You can build production ready image with dockerfile like this:

FROM recognizebv/symfony-docker:php7.1
ADD . /var/www/html
# Add your application build steps here, for example:
# RUN ./var/www/html/web/bin/...
RUN rm -rf /var/www/html/web/app_dev.php
RUN rm -rf /var/www/html/web/config.php

FAQ

What are extensions enabled by default?

  • apache mod_rewrite
  • intl
  • opcache
  • pdo
  • pdo_mysql
  • pdo_pgsql
  • zip
  • gd
  • xdebug (only in dev images)

How do i install additional php extensions?

This work is based on official dockerhub php images. You can use docker-php-ext-install to add new extensions. More informations can be found https://hub.docker.com/_/php/

Why can't i access app_dev.php?

By default symfony block requests to app_dev.php that come from non localhost sources. You can change that editing app_dev.php file.

symfony-docker's People

Contributors

jakubsacha avatar juulrecognize avatar sarongrave avatar tom-reinders avatar wslaghekke avatar

Watchers

 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.