Skip to content

Commit

Permalink
Adds dockerfiles for the joblocal base images
Browse files Browse the repository at this point in the history
  • Loading branch information
smuehlbauer committed Aug 29, 2018
0 parents commit 7de7150
Show file tree
Hide file tree
Showing 17 changed files with 313 additions and 0 deletions.
13 changes: 13 additions & 0 deletions node/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:10.8.0-alpine

LABEL maintainer="joblocal GmbH <produktentwicklung@joblocal.de>"

RUN apk add --update python3 \
curl \
bash \
&& rm -rf /var/cache/apk/*

RUN curl -O https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py \
&& pip install --upgrade pip \
&& pip install awscli --upgrade
45 changes: 45 additions & 0 deletions php/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM alpine:3.7

LABEL maintainer="joblocal GmbH <produktentwicklung@joblocal.de>"

ENV \
DEPS="ca-certificates \
nginx \
nginx-mod-http-headers-more \
memcached \
php7 \
php7-fpm \
php7-curl \
php7-ctype \
php7-dom \
php7-memcached \
php7-mbstring \
php7-json \
php7-xml \
php7-pdo_mysql \
php7-pdo_sqlite \
php7-simplexml \
runit \
bash"

RUN addgroup -g 1000 -S www-data \
&& adduser -u 1000 -D -S -G www-data www-data

RUN apk add --update $DEPS \
&& rm -rf /var/cache/apk/* \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log


# Set Timezone to UTC and remove apk cache
RUN apk add --update tzdata \
&& cp /usr/share/zoneinfo/UTC /etc/localtime \
&& echo "UTC" > /etc/timezone \
&& apk del tzdata \
&& rm -rf /var/cache/apk/*

COPY ./rootfs /

EXPOSE 80

CMD ["/sbin/runit-wrapper"]
37 changes: 37 additions & 0 deletions php/app/rootfs/etc/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
server {
listen 80 default_server;

charset utf-8;

root /var/www/public;
index index.php index.html;

location = /ping {
access_log off;
log_not_found off;

try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

location / {
# remove trailing slash
rewrite ^/(.*)/$ /$1 permanent;

# try to find requested file
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
66 changes: 66 additions & 0 deletions php/app/rootfs/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
daemon off;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
variables_hash_max_size 2048;
variables_hash_bucket_size 1024;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
1 change: 1 addition & 0 deletions php/app/rootfs/etc/php7/conf.d/custom_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
expose_php = Off
1 change: 1 addition & 0 deletions php/app/rootfs/etc/php7/mods-available/memcached.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension=memcached.so
49 changes: 49 additions & 0 deletions php/app/rootfs/etc/php7/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[global]
pid = /var/run/php-fpm.pid
error_log = /proc/self/fd/2
daemonize = no
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10s

[www]
user = www-data
group = www-data
listen = /var/run/php-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 35
pm.start_servers = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 25
pm.max_requests = 500
chdir = /
catch_workers_output = yes
; access.log = /proc/self/fd/2
slowlog = /proc/self/fd/2
request_slowlog_timeout = 30s

; environment variables
env[APP_ENV]=$APP_ENV
env[APP_DEBUG]=$APP_DEBUG
env[APP_KEY]=$APP_KEY

env[DB_CONNECTION]=$DB_CONNECTION

env[CACHE_DRIVER]=$CACHE_DRIVER
env[MEMCACHED_HOST]=$MEMCACHED_HOST
env[MEMCACHED_PORT]=$MEMCACHED_PORT

env[AWS_ACCESS_KEY_ID]=$AWS_ACCESS_KEY_ID
env[AWS_SECRET_ACCESS_KEY]=$AWS_SECRET_ACCESS_KEY
env[AWS_DEFAULT_REGION]=$AWS_DEFAULT_REGION

env[QUEUE_DRIVER]=$QUEUE_DRIVER
env[QUEUE_URL]=$QUEUE_URL

env[GUZZLE_BASE_URI]=$GUZZLE_BASE_URI
env[GUZZLE_TIMEOUT]=$GUZZLE_TIMEOUT

env[SENTRY_DSN]=$SENTRY_DSN
7 changes: 7 additions & 0 deletions php/app/rootfs/etc/service/nginx/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

exec 2>&1
source /env

mkdir -p /run/nginx
exec /usr/sbin/nginx -c '/etc/nginx/nginx.conf'
3 changes: 3 additions & 0 deletions php/app/rootfs/etc/service/php-fpm/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

/usr/sbin/php-fpm7
17 changes: 17 additions & 0 deletions php/app/rootfs/sbin/runit-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

main() {
export > /env

trap onterm SIGTERM SIGINT

/sbin/runsvdir-start &
wait "$!"
}

onterm() {
pkill -SIGHUP runsvdir-start
exit $?
}

main "$@"
5 changes: 5 additions & 0 deletions php/app/rootfs/sbin/runsvdir-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

export PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin

exec runsvdir -P /etc/service
Binary file added php/app/rootfs/usr/lib/php/20151012/memcached.so
Binary file not shown.
23 changes: 23 additions & 0 deletions php/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM joblocal/base-app:alpine-3.7

LABEL maintainer="joblocal GmbH <produktentwicklung@joblocal.de>"

RUN apk add --update \
curl \
ghostscript \
imagemagick \
php7-apcu \
php7-fileinfo \
php7-iconv \
php7-imagick \
php7-opcache \
php7-phar \
php7-simplexml \
php7-tokenizer \
php7-xsl \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& rm -rf /var/cache/apk/*

WORKDIR /workspace

VOLUME /workspace
37 changes: 37 additions & 0 deletions php/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM alpine:3.7

LABEL maintainer="joblocal GmbH <produktentwicklung@joblocal.de>"

ENV \
DEPS="ca-certificates \
memcached \
php7 \
php7-curl \
php7-ctype \
php7-dom \
php7-memcached \
php7-mbstring \
php7-json \
php7-xml \
php7-pdo_mysql \
php7-pdo_sqlite \
php7-simplexml \
runit \
bash"

RUN addgroup -g 1000 -S www-data \
&& adduser -u 1000 -D -S -G www-data www-data

RUN apk add --update $DEPS \
&& rm -rf /var/cache/apk/*

# Set Timezone to UTC
RUN apk add --update tzdata \
&& cp /usr/share/zoneinfo/UTC /etc/localtime \
&& echo "UTC" > /etc/timezone \
&& apk del tzdata \
&& rm -rf /var/cache/apk/*

COPY ./rootfs /

CMD ["/usr/bin/queuelistener.sh"]
1 change: 1 addition & 0 deletions php/worker/rootfs/etc/php7/mods-available/memcached.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension=memcached.so
8 changes: 8 additions & 0 deletions php/worker/rootfs/usr/bin/queuelistener.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

echo "Starting queue listener"
/usr/bin/php /var/www/artisan queue:listen \
--tries=4 \
--sleep=0 \
--timeout=300 \
--memory=128
Binary file not shown.

0 comments on commit 7de7150

Please sign in to comment.