GithubHelp home page GithubHelp logo

docker-apache-symfony's Introduction

docker-apache-symfony

Docker image with fairly minimal requirements for running Symfony 2.

Based on/provides:

  • Debian Jessie
  • Apache 2.4
  • PHP 5.6 (mod_php and cli)
  • php5-intl
  • php5-curl

Why?

I needed an image based on Debian, and I believe the image should include as few additional components as possible (you can base an image off this with your additional requirements).

Example usage

You can build and run a Symfony 2 demo application from scratch with the following steps.

Create a Symfony project on the host system:

mkdir ~/hello && cd ~/hello
docker run --rm -v $(pwd):/app composer/composer create-project symfony/framework-standard-edition:2.8 --no-interaction .

Create the Dockerfile:

echo "FROM fazy/apache-symfony" > Dockerfile
echo "ADD . /app" >> Dockerfile

Build and run the Docker image:

docker build -t symfony/hello .
docker run -d -p 8000:80 --name hello symfony/hello

Visit your new website:

curl -v http://localhost:8000

Containerising your own app

To build a container including an existing Symfony app:

Create a Dockerfile in the root of your application (e.g. /my-app):

FROM fazy/apache-symfony
ADD . /app

You might want to replace the above ADD line with something more specific:

ADD vendor /app/vendor
ADD bin /app/bin
ADD app /app/app
ADD src /app/src
ADD web /app/web

Adding vendor first might help a little with caching, assuming vendor changes less frequently than the others.

Build your container and commit:

cd /app
docker build -t myname/myapp .
docker commit

You can then pull and run your Docker image anywhere.

Extending the app

To install more packages, add this to your Dockerfile:

RUN    apt-get update \
    && apt-get -yq install \
        <package-1> \
        <package-2> \
    && rm -rf /var/lib/apt/lists/*

Replace <package-1>, <package-2> with a list of packages to install.

To use your own Apache config, you can create your own version of the vhost.conf in this project, then ADD it in your Dockerfile:

ADD vhost.conf /etc/apache2/sites-available/000-default.conf

docker-apache-symfony's People

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.