Git Product home page Git Product logo

docker-webserver's Introduction

Web Server

Nginx & PHP 7 web server.

Laravel Application - Quick Run

Using the Laravel installer you can get up and running with a Laravel application inside Docker in minutes.

  • Create a new Laravel application $ laravel new testapp
  • Change to the applications directory $ cd testapp
  • Start the container and attach the application. $ docker run -d -p 4488:80 --name=testapp -v $PWD:/var/www creativitykills/nginx-php-server
  • Visit the Docker container URL like http://0.0.0.0:4488. Profit!

Args

Here are some args

  • NGINX_HTTP_PORT - HTTP port. Default: 80.
  • NGINX_HTTPS_PORT - HTTPS port. Default: 443.
  • PHP_VERSION - The PHP version to install. Supports: 7.3. Default: 7.3.
  • ALPINE_VERSION - The Alpine version. Supports: 3.9. Default: 3.9.

Environment Variables

Here are some configurable environment values.

  • WEBROOT – Path to the web root. Default: /var/www
  • WEBROOT_PUBLIC – Path to the web root. Default: /var/www/public
  • COMPOSER_DIRECTORY - Path to the composer.json containing directory. Default: /var/www.
  • COMPOSER_INSTALL_ON_BUILD - Should composer install run on build. Default: 0.
  • LARAVEL_APP - Is this a Laravel application. Default 0.
  • RUN_LARAVEL_SCHEDULER - Should the Laravel scheduler command run. Only works if LARAVEL_APP is 1. Default: 0.
  • RUN_LARAVEL_MIGRATIONS_ON_BUILD - Should the migrate command run during build. Only works if LARAVEL_APP is 1. Default: 0.
  • PRODUCTION – Is this a production environment. Default: 0
  • PHP_MEMORY_LIMIT - PHP memory limit. Default: 128M
  • PHP_POST_MAX_SIZE - Maximum POST size. Default: 50M
  • PHP_UPLOAD_MAX_FILESIZE - Maximum file upload file. Default: 10M.

docker-webserver's People

Contributors

avonnadozie avatar henridv avatar jonathanitakpe avatar narteysarso avatar neoighodaro avatar sabado avatar vladotesanovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-webserver's Issues

Adding PHP ext

Love the image, good job.

What would be your advice to add a mssql EXT?

Thank you

Laravel Scout need pdo_sqlite extension

Hello, thank you for creating this repo. Is there some method for us to easily add some php extension? Or maybe if that is too much, can we add every pdo_* extension that is currently used by some laravel packages?

PHP 7.1 support

Will you be updating the docbase/create a new branch for php7.1. The latest laravel installation is breaking with the following error in the log
[error] 21#21: *1 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '?' in /var/www/app/vendor/symfony/http-foundation/Response.php on line 501 PHP message: PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0 PHP message: PHP Parse error: syntax error, unexpected '?' in /var/www/app/vendor/symfony/http-foundation/Response.php on line 501

I am using the following composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}```

ERROR: unsatisfiable constraints

Hello @neoighodaro

I receive this error message when i try to build this image from stretch:

Docker version 18.06.1-ce, build e68fc7a

Sending build context to Docker daemon  347.1kB
Step 1/23 : FROM nginx:mainline-alpine
mainline-alpine: Pulling from library/nginx
8e402f1a9c57: Already exists 
56b0d9b69cc9: Pull complete 
b66c8bb200cc: Pull complete 
4ec77fc9c55f: Pull complete 
Digest: sha256:d5e177fed5e4f264e55b19b84bdc494078a06775612a4f60963f296756ea83aa
Status: Downloaded newer image for nginx:mainline-alpine
 ---> 0476319fbdad
Step 2/23 : LABEL maintainer="Neo Ighodaro <[email protected]>"
 ---> Running in 9873fb78b96d
Removing intermediate container 9873fb78b96d
 ---> e3a4ce425994
Step 3/23 : RUN apk --update --no-cache add ca-certificates     bash     supervisor
 ---> Running in 271f10bc0298
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/14) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(2/14) Installing ncurses-terminfo (6.1_p20190105-r0)
(3/14) Installing ncurses-libs (6.1_p20190105-r0)
(4/14) Installing readline (7.0.003-r1)
(5/14) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(6/14) Installing ca-certificates (20190108-r0)
(7/14) Installing expat (2.2.6-r0)
(8/14) Installing libffi (3.2.1-r6)
(9/14) Installing gdbm (1.13-r1)
(10/14) Installing sqlite-libs (3.26.0-r3)
(11/14) Installing python2 (2.7.15-r3)
(12/14) Installing py-meld3 (1.0.2-r1)
(13/14) Installing py-setuptools (40.6.3-r0)
(14/14) Installing supervisor (3.3.4-r1)
Executing busybox-1.29.3-r10.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 72 MiB in 43 packages
Removing intermediate container 271f10bc0298
 ---> b3f4c5b612cd
Step 4/23 : ADD https://php.codecasts.rocks/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
Downloading [==================================================>]     451B/451B

 ---> e0b801350a6d
Step 5/23 : ARG PHP_VERSION=7.2
 ---> Running in 5e37b0be13f1
Removing intermediate container 5e37b0be13f1
 ---> 02cc085f0d09
Step 6/23 : ARG ALPINE_VERSION=3.7
 ---> Running in 57111088d650
Removing intermediate container 57111088d650
 ---> 40f9ee798597
Step 7/23 : ARG COMPOSER_HASH=544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061
 ---> Running in 6593d1b5296e
Removing intermediate container 6593d1b5296e
 ---> e48ff0e378e8
Step 8/23 : ARG NGINX_HTTP_PORT=80
 ---> Running in 1f24b2ee6594
Removing intermediate container 1f24b2ee6594
 ---> 1bbb0e85bcce
Step 9/23 : ARG NGINX_HTTPS_PORT=443
 ---> Running in 9a8e9154a8d4
Removing intermediate container 9a8e9154a8d4
 ---> 548441b7be1f
Step 10/23 : RUN echo "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" > /etc/apk/repositories &&     echo "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" >> /etc/apk/repositories &&     echo "@php https://php.codecasts.rocks/v${ALPINE_VERSION}/php-${PHP_VERSION}" >> /etc/apk/repositories
 ---> Running in 28555fc54007
Removing intermediate container 28555fc54007
 ---> ea6ceb8c9ae1
Step 11/23 : RUN apk add --no-cache --update php-fpm@php     php@php     php-openssl@php     php-pdo@php     php-pdo_mysql@php     php-mbstring@php     php-phar@php     php-session@php     php-dom@php     php-ctype@php     php-zlib@php     php-json@php     php-xml@php &&     ln -s /usr/bin/php7 /usr/bin/php
 ---> Running in 0e3699f33323
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
fetch https://php.codecasts.rocks/v3.7/php-7.2/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  php7-mysqlnd-7.1.17-r0:
    breaks: php7-pdo_mysql-7.2.13-r3[php7-mysqlnd>=7.2.0]
    satisfies: php7-pdo_mysql-7.2.13-r3[php7-mysqlnd<7.3.0]
The command '/bin/sh -c apk add --no-cache --update php-fpm@php     php@php     php-openssl@php     php-pdo@php     php-pdo_mysql@php     php-mbstring@php     php-phar@php     php-session@php     php-dom@php     php-ctype@php     php-zlib@php     php-json@php     php-xml@php &&     ln -s /usr/bin/php7 /usr/bin/php' returned a non-zero code: 1

Error log

Blank screen

I did a clone over the repo, then run docker-compose up -d and if i visit http://localhost:8888/ a blank screen appears.

docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
79f035adadc5 acme_web "/start.sh" 24 seconds ago Up 22 seconds 443/tcp, 0.0.0.0:8888->80/tcp web
c40b32e0bdc0 acme_mysql "docker-entrypoint.s…" 24 seconds ago Restarting (1) 4 seconds ago mysql
cccef5e5920e acme_redis "docker-entrypoint.s…" 24 seconds ago Up 22 seconds 6379/tcp redis

I don't know much about Docker but why do i have the ip 0.0.0.0 listed there? is this the issue maybe?

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.