Skip to content
This repository was archived by the owner on Apr 25, 2022. It is now read-only.

Commit dd4316f

Browse files
committed
Merge pull request #13 from mathewpeterson/feature/separate-containers
[WIP] Feature/separate containers
2 parents 3043f45 + 434645d commit dd4316f

File tree

17 files changed

+269
-113
lines changed

17 files changed

+269
-113
lines changed

Dockerfile

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

docker-compose.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
web:
2-
build: .
3-
container_name: symfony-docker
4-
ports:
5-
- "8888:8888"
6-
volumes:
7-
- .:/app
8-
- ./docker/nginx/vhost_dev.conf:/etc/nginx/sites-enabled/default
1+
app:
2+
container_name: symfony-docker-app
3+
image: ubuntu:trusty
4+
volumes:
5+
- .:/app
6+
tty: true
7+
8+
php:
9+
container_name: symfony-docker-php
10+
build: docker/php
11+
volumes_from:
12+
- app
13+
links:
14+
- mariadb
15+
- memcached
16+
nginx:
17+
container_name: symfony-docker-nginx
18+
build: docker/nginx
19+
volumes_from:
20+
- app
921
links:
10-
- mariadb
11-
- memcached
22+
- php
1223
environment:
13-
VIRTUAL_HOST: symfony-docker.dev
14-
VIRTUAL_PORT: 8888
24+
VIRTUAL_HOST: symfony-docker.palantir.local
1525

1626
mariadb:
1727
image: tutum/mariadb
18-
container_name: api-mariadb
28+
container_name: symfony-docker-mariadb
1929
environment:
2030
MARIADB_USER: admin
2131
MARIADB_PASS: admin
@@ -24,6 +34,6 @@ mariadb:
2434

2535
memcached:
2636
image: memcached:1.4
27-
container_name: api-memcached
37+
container_name: symfony-docker-memcached
2838
ports:
2939
- "11211:11211"

docker/nginx/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM nginx
2+
3+
MAINTAINER Mathew Peterson <mathewpeterson@me.com>
4+
5+
COPY conf/vhost_dev.conf /etc/nginx/nginx.conf

docker/nginx/conf/vhost_dev.conf

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
user www-data;
2+
worker_processes 4;
3+
pid /run/nginx.pid;
4+
5+
events {
6+
worker_connections 2048;
7+
multi_accept on;
8+
use epoll;
9+
}
10+
11+
http {
12+
server_tokens off;
13+
sendfile on;
14+
tcp_nopush on;
15+
tcp_nodelay on;
16+
keepalive_timeout 15;
17+
types_hash_max_size 2048;
18+
include /etc/nginx/mime.types;
19+
default_type application/octet-stream;
20+
access_log off;
21+
error_log off;
22+
gzip on;
23+
gzip_disable "msie6";
24+
open_file_cache max=100;
25+
26+
upstream php-upstream { server php:9000; }
27+
28+
server {
29+
access_log /dev/stdout;
30+
error_log /dev/stdout info;
31+
32+
root /app/web;
33+
index app_dev.php;
34+
35+
location = /favicon.ico {
36+
log_not_found off;
37+
access_log off;
38+
}
39+
40+
location = /robots.txt {
41+
allow all;
42+
log_not_found off;
43+
access_log off;
44+
}
45+
46+
location / {
47+
try_files $uri @rewriteapp;
48+
}
49+
50+
location @rewriteapp {
51+
rewrite ^(.*)$ /app_dev.php/$1 last;
52+
}
53+
54+
location ~ ^/(app_dev|config)\.php(/|$) {
55+
fastcgi_pass php-upstream;
56+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
57+
include fastcgi_params;
58+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
59+
fastcgi_param HTTPS off;
60+
}
61+
}
62+
}

docker/nginx/conf/vhost_prod.conf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
user www-data;
2+
worker_processes 4;
3+
pid /run/nginx.pid;
4+
5+
events {
6+
worker_connections 2048;
7+
multi_accept on;
8+
use epoll;
9+
}
10+
11+
http {
12+
server_tokens off;
13+
sendfile on;
14+
tcp_nopush on;
15+
tcp_nodelay on;
16+
keepalive_timeout 15;
17+
types_hash_max_size 2048;
18+
include /etc/nginx/mime.types;
19+
default_type application/octet-stream;
20+
access_log off;
21+
error_log off;
22+
gzip on;
23+
gzip_disable "msie6";
24+
open_file_cache max=100;
25+
26+
upstream php-upstream { server php:9000; }
27+
28+
server {
29+
access_log /dev/stdout;
30+
error_log /dev/stdout info;
31+
gzip on;
32+
gzip_comp_level 4;
33+
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
34+
35+
36+
root /app/web;
37+
index app.php;
38+
39+
location = /favicon.ico {
40+
log_not_found off;
41+
access_log off;
42+
}
43+
44+
location = /robots.txt {
45+
allow all;
46+
log_not_found off;
47+
access_log off;
48+
}
49+
50+
location / {
51+
try_files $uri @rewriteapp;
52+
}
53+
54+
location @rewriteapp {
55+
rewrite ^(.*)$ /app.php/$1 last;
56+
}
57+
58+
location ~ ^/(app)\.php(/|$) {
59+
fastcgi_pass php-upstream;
60+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
61+
include fastcgi_params;
62+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
63+
fastcgi_param HTTPS off;
64+
}
65+
}
66+
}

docker/nginx/vhost_dev.conf

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

docker/nginx/vhost_prod.conf

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

docker/php/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM php:5.6-fpm
2+
3+
MAINTAINER Mathew Peterson <mathewpeterson@me.com>
4+
5+
COPY bin/* /usr/local/bin/
6+
RUN chmod +x -R /usr/local/bin/
7+
8+
COPY conf/php.ini /usr/local/etc/php/conf.d/
9+
COPY conf/pool.conf /usr/local/etc/php/
10+
11+
WORKDIR /app
12+
13+
RUN apt-install \
14+
apt-utils \
15+
less \
16+
libssl-dev \
17+
git \
18+
zip \
19+
libfreetype6-dev \
20+
libjpeg62-turbo-dev \
21+
libpng12-dev
22+
23+
RUN mkdir -p /tmp \
24+
&& docker-php-ext-configure gd \
25+
--with-freetype-dir=/usr/include/ \
26+
--with-jpeg-dir=/usr/include/ \
27+
&& docker-php-ext-install \
28+
gd \
29+
pdo \
30+
pdo_mysql \
31+
&& docker-php-pecl-install zip memcached xdebug
32+
33+
RUN curl -sS https://getcomposer.org/installer | php -- \
34+
--install-dir=/usr/local/bin \
35+
--filename=composer && \
36+
echo "phar.readonly = off" > /usr/local/etc/php/conf.d/phar.ini
37+
38+
CMD ["php-fpm"]

docker/php/bin/apt-install

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
4+
apt-get update
5+
apt-get install "$@" --no-install-recommends -y
6+
apt-get clean
7+
8+
rm -rf /var/lib/apt/lists/*

docker/php/bin/apt-purge

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
exec apt-get purge -y --auto-remove \
3+
-o APT::AutoRemove::RecommendsImportant=false \
4+
-o APT::AutoRemove::SuggestsImportant=false \
5+
"$@"
6+
Status API Training Shop Blog About Pricing

0 commit comments

Comments
 (0)