Skip to content

Commit 9600382

Browse files
committed
Merge branch 'release/0.1.0'
2 parents 4c52dfe + 272b4c2 commit 9600382

File tree

12 files changed

+323
-3
lines changed

12 files changed

+323
-3
lines changed

Dockerfile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
FROM php:7.3.8-fpm-alpine3.10
2+
3+
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
4+
PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \
5+
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
6+
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
7+
8+
RUN apk info \
9+
&& echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
10+
&& echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
11+
&& echo @3.8 http://dl-cdn.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories \
12+
&& apk update \
13+
&& apk upgrade \
14+
&& apk add --no-cache --virtual .build-deps \
15+
$PHPIZE_DEPS \
16+
&& apk add --no-cache \
17+
sudo \
18+
runit \
19+
nginx \
20+
zlib-dev \
21+
icu-dev \
22+
imagemagick-dev \
23+
libzip-dev \
24+
libjpeg-turbo-dev \
25+
libpng-dev \
26+
libxml2-dev \
27+
freetype-dev \
28+
bash \
29+
git \
30+
nodejs \
31+
composer \
32+
php7-tokenizer \
33+
php7-simplexml \
34+
php7-dom \
35+
mysql-client \
36+
yarn@edge \
37+
libgcj@3.8 \
38+
xvfb \
39+
chromium@edge \
40+
chromium-chromedriver@edge \
41+
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
42+
&& docker-php-ext-install -j$(nproc) \
43+
gd \
44+
pdo_mysql \
45+
zip \
46+
bcmath \
47+
exif \
48+
&& docker-php-ext-install \
49+
intl \
50+
zip \
51+
opcache \
52+
pcntl \
53+
&& pecl install imagick \
54+
&& docker-php-ext-enable imagick \
55+
&& apk del .build-deps
56+
57+
# change default shell
58+
SHELL ["/bin/bash", "-c"]
59+
60+
# create app user
61+
RUN addgroup -S app && \
62+
adduser -S app -G app && \
63+
echo "app ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
64+
65+
# create working dir
66+
RUN mkdir /opt/app
67+
WORKDIR /opt/app
68+
69+
# install wait-for-it
70+
ADD https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh /usr/local/bin/
71+
RUN chmod +x /usr/local/bin/wait-for-it.sh
72+
73+
# copy runit services
74+
COPY ./etc/service/ /etc/service/
75+
RUN find /etc/service/ -name "run" -exec chmod -v +x {} \;
76+
77+
# copy nginx config files
78+
COPY ./etc/nginx/ /etc/nginx/
79+
80+
# copy php config files
81+
COPY ./usr/local/etc/php/ /usr/local/etc/php/
82+
COPY ./usr/local/etc/php-fpm.d/ /usr/local/etc/php-fpm.d/
83+
84+
# configure composer
85+
ENV COMPOSER_ALLOW_SUPERUSER=1
86+
ENV PATH="$PATH:./vendor/bin:~/.composer/vendor/bin"
87+
RUN composer global require hirak/prestissimo
88+
89+
# configure yarn
90+
RUN yarn config set strict-ssl false && \
91+
yarn global add cross-env
92+
93+
# copy home folder and make run scripts executable
94+
COPY ./home/app/ /home/app/
95+
RUN find /home/app -name "run-*.sh" -exec chmod -v +x {} \;
96+
97+
# run the application
98+
CMD /home/app/run-dev.sh

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Sourceboat GmbH & Co. KG <info@sourceboat.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# docker-laravel `WIP`
2+
3+
[![Docker Build Status](https://img.shields.io/docker/cloud/build/sourceboat/docker-laravel.svg?style=flat-square)](https://hub.docker.com/r/sourceboat/docker-laravel/builds/)
4+
[![Release](https://img.shields.io/github/release/sourceboat/docker-laravel.svg?style=flat-square)](https://github.com/sourceboat/docker-laravel/releases)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/sourceboat/docker-laravel.svg?style=flat-square)](https://hub.docker.com/r/sourceboat/docker-laravel/)
6+
[![MicroBadger Size](https://img.shields.io/microbadger/image-size/sourceboat/docker-laravel.svg?style=flat-square)](https://microbadger.com/images/sourceboat/docker-laravel)
7+
[![MicroBadger Layers](https://img.shields.io/microbadger/layers/sourceboat/docker-laravel.svg?style=flat-square)](https://microbadger.com/images/sourceboat/docker-laravel)
8+
9+
A highly opinionated docker image which aims to be perfectly suited to run our Laravel applications.
10+
11+
## What's included?
12+
13+
`WIP`
14+
15+
## Usage
16+
17+
`WIP`
18+
19+
## Changelog
20+
21+
Check [releases](https://github.com/sourceboat/docker-laravel/releases) for all notable changes.
22+
23+
## Credits
24+
25+
- [Phil-Bastian Berndt](https://github.com/pehbehbeh)
26+
- [All Contributors](https://github.com/sourceboat/docker-laravel/graphs/contributors)
27+
28+
## License
29+
30+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

etc/nginx/conf.d/default.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
map $http_x_forwarded_proto $is_https {
2+
default '';
3+
https 'on';
4+
}
5+
6+
server {
7+
server_name _;
8+
listen 8080 default_server;
9+
listen [::]:8080 default_server;
10+
11+
client_max_body_size 50M;
12+
13+
index index.php index.html;
14+
root /opt/app/public;
15+
16+
location / {
17+
try_files $uri /index.php?$args;
18+
}
19+
20+
location ~ [^/]\.php(/|$) {
21+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
22+
fastcgi_pass 127.0.0.1:9000;
23+
fastcgi_index index.php;
24+
include fastcgi_params;
25+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
26+
fastcgi_param PATH_INFO $fastcgi_path_info;
27+
fastcgi_param HTTPS $is_https;
28+
}
29+
}

etc/nginx/nginx.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
user nginx;
2+
worker_processes 4;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
multi_accept on;
10+
use epoll;
11+
}
12+
13+
http {
14+
include /etc/nginx/mime.types;
15+
default_type application/octet-stream;
16+
17+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18+
'$status $body_bytes_sent "$http_referer" '
19+
'"$http_user_agent" "$http_x_forwarded_for"';
20+
21+
access_log /var/log/nginx/access.log main;
22+
23+
sendfile on;
24+
25+
keepalive_timeout 65;
26+
27+
include /etc/nginx/conf.d/*.conf;
28+
}

etc/service/nginx/run

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec nginx -g "daemon off;"

etc/service/php-fpm/run

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec php-fpm --nodaemonize -R

home/app/.bashrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# useful aliases
2+
alias ll='ls -la'
3+
alias artisan="php artisan"

home/app/run-dev.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
echo "Running via DEV script..."
3+
cd /opt/app
4+
5+
# Make sure Laravel can write its own files
6+
mkdir -p /opt/app/storage/logs/
7+
touch /opt/app/storage/logs/laravel.log
8+
touch /opt/app/storage/logs/worker.log
9+
chown www-data:www-data -R /opt/app/storage
10+
chown www-data:www-data -R /opt/app/bootstrap/cache
11+
12+
# install dependencies
13+
composer install --prefer-dist --no-progress --no-interaction
14+
yarn
15+
16+
# migrate and setup database
17+
wait-for-it.sh mysql:3306
18+
php artisan migrate --force
19+
20+
# start the services
21+
exec runsvdir /etc/service

readme.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)