GithubHelp home page GithubHelp logo

ubuntu-16-laravel-application's Introduction

Laravel 5 Application Base on Ubuntu 16 PHP 7.1

Current Status: Work In Progress

A Docker image to use as a basis for Docker contained Laravel 5 applications based on PHP 7.1, which will be running under OpenShift.

Usage

Creating your own application image

  1. Create a Dockerfile in your project folder.

    Basic example:

    FROM 1and1internet/ubuntu-16-laravel-application
    COPY src/ ./
    RUN \
    	composer install \
    		--no-ansi \
    		--no-dev \
    		--no-interaction \
    		--no-progress \
    		--prefer-dist && \
    	php artisan --no-ansi --no-interaction optimize && \
    	application-set-file-permissions
    

    A more complex example of what you might want your Dockerfile to look like:

    FROM 1and1internet/ubuntu-16-laravel-application
    # Copy in various additional required files (like init scripts).
    COPY files /
    # Install dependencies via composer (these don't change often during development)
    COPY src/composer* ./
    RUN \
    	composer install \
    		--no-ansi \
    		--no-dev \
    		--no-interaction \
    		--no-progress \
    		--prefer-dist
    # Copy in the application source code
    COPY src/ ./
    # Copy in the default configuration
    COPY default.env ./.env
    # Perform additional setup required for the application
    RUN \
    	application-component-remove scheduler && \
    	application-component-remove worker && \
    	php artisan --no-ansi --no-interaction optimize && \
    	application-set-file-permissions
    
  2. Place your laravel application code in ./src/

    composer create-project --prefer-dist laravel/laravel ./src/
    
  3. Build your docker image

    docker build -t mylaravelapp .
    
  4. See it running

    docker run -d -P mylaravelapp
    

For configuring passwords, etc, I recommend environment variables via the --env-file paramter to docker run. Please see the Docker documentation for further details.

Deploying to OpenShift

  1. Modify the openshift-template file.

    • Change the image names
    • Remove any of the components which are you not using
    • Modify run as user ID numbers
    • Modify the volume configuration to match that required by your openshift cluster
  2. Run the new-app command

    oc new-app --file=openshift-template.yaml --param=APP_HOSTNAME_SUFFIX=.laravelapp.example.com
    

Environment variables

All configuration is via environment variables.

  • Just OpenShift

    • APP_NAME - Name of this Laravel application (maximum 17 characters)
    • APP_DB_DATABASE - Database database name
    • APP_HOSTNAME_SUFFIX - HTTPS hostname suffix for the routes
  • Both Docker and OpenShift

    • APP_WORKER_QUEUES - defaults to high,low
    • APP_WORKER_TIMEOUT - defaults to 180
    • WAIT_FOR_DB_MIGRATIONS - triggers early call to php artisan migrate:monitor (defaults off)

ubuntu-16-laravel-application's People

Contributors

astrolox avatar cstretton avatar mintopia 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.