This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a5827fb
Showing
20 changed files
with
314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
05-compose-with-volum/.data | ||
06-development-env/.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM nginx | ||
|
||
COPY index.html /usr/share/nginx/html | ||
|
||
# Build l'image et la tagger | ||
# docker build -t nginx:demo_meetup . | ||
|
||
# Voir les images docker : | ||
# docker images | ||
|
||
# Lancement du container à partir de l'image | ||
# docker run -d --name web -p 8080:80 nginx:demo_meetup | ||
|
||
# Visiter http://localhost:8080 | ||
|
||
# Voir les logs de Nginx | ||
# docker logs web | ||
|
||
# --- | ||
|
||
# Stoper le container | ||
# docker stop web | ||
|
||
# Supprimer le container | ||
# docker rm web | ||
|
||
# Supprimer les images | ||
# docker rmi nginx:demo_meetup nginx:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>hello world</title> | ||
</head> | ||
<body> | ||
<p>hello world !</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## NOTICE | ||
|
||
|
||
### notes : | ||
|
||
$PWD return the absolute path to your current directory, test in your terminal: | ||
|
||
echo $PWD | ||
/home/thibaut/meetup_docker_101/02-volumes | ||
|
||
|
||
### Use Nginx official image & mount custom config inside : | ||
|
||
docker run -d \ | ||
--name web \ | ||
-p 8080:80 \ | ||
-v $PWD:/home/docker \ | ||
-v $PWD/nginx.conf:/etc/nginx/conf.d/default.conf \ | ||
nginx | ||
|
||
### Connect to the running container and view files : | ||
|
||
# Connect to the container | ||
docker exec -ti web /bin/bash | ||
|
||
# View the files | ||
root@51aafa93a21e:/# cd /home/docker/ | ||
root@51aafa93a21e:/home/docker# ls -alh | ||
drwxrwxr-x 2 1000 1000 4.0K Sep 25 20:25 . | ||
drwxr-xr-x 3 root root 4.0K Sep 25 20:16 .. | ||
-rw-rw-r-- 1 1000 1000 492 Sep 25 20:25 README.md | ||
-rw-rw-r-- 1 1000 1000 123 Sep 25 20:15 nginx.conf | ||
-rw-rw-r-- 1 1000 1000 113 Sep 22 19:31 toto.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
listen 80; | ||
root /home/docker; | ||
|
||
index toto.html; | ||
|
||
error_log /dev/fd/1; | ||
access_log /dev/fd/1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>hello world</title> | ||
</head> | ||
<body> | ||
<p>hello world !</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## NOTICE | ||
|
||
How to bind to container together ? | ||
example with nginx + php7.1-fpm | ||
|
||
(don't forget to cd to this directory before) | ||
|
||
|
||
### Create docker network: | ||
|
||
docker network create demo_meetup | ||
|
||
|
||
### Star PHP container : | ||
|
||
docker run -d \ | ||
--name php \ | ||
-v $PWD:/home/docker \ | ||
--network demo_meetup \ | ||
php:7.1-fpm | ||
|
||
|
||
### Start Nginx container : | ||
|
||
docker run -d \ | ||
--name web \ | ||
-p ${NGINX_PORT}:80 \ | ||
-p ${NGINX_HTTPS_PORT}:443 \ | ||
-v $PWD:/home/docker \ | ||
-v $PWD/nginx.conf:/etc/nginx/conf.d/default.conf \ | ||
--network ${NETWORKS} \ | ||
nginx | ||
|
||
### Visit [http://localhost:8080](http://localhost:8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
echo "hello world in php !"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
server { | ||
listen 80; | ||
|
||
root /home/docker; | ||
|
||
location / { | ||
try_files $uri @rewriteapp; | ||
} | ||
|
||
location @rewriteapp { | ||
rewrite ^(.*)$ /index.php/$1 last; | ||
} | ||
|
||
location ~ ^/(index)\.php(/|$) { | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_pass php:9000; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
} | ||
|
||
error_log /dev/fd/1; | ||
access_log /dev/fd/1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
nginx: | ||
image: nginx | ||
ports: | ||
- "8080:80" | ||
volumes: | ||
- ".:/home/docker" | ||
- "./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro" | ||
networks: | ||
- demo_meetup | ||
|
||
php: | ||
image: php:7.1-fpm | ||
volumes: | ||
- "./docker:/home/docker" | ||
- "./docker/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro" | ||
working_dir: "/home/docker" | ||
networks: | ||
- demo_meetup | ||
|
||
networks: | ||
demo_meetup: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
echo "hello world in php with docker-compose !"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
server { | ||
listen 80; | ||
|
||
root /home/docker; | ||
|
||
location / { | ||
try_files $uri @rewriteapp; | ||
} | ||
|
||
location @rewriteapp { | ||
rewrite ^(.*)$ /index.php/$1 last; | ||
} | ||
|
||
location ~ ^/(index)\.php(/|$) { | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_pass php:9000; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
} | ||
|
||
error_log /dev/fd/1; | ||
access_log /dev/fd/1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
date.timezone = Europe/Paris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
db: | ||
image: mysql | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- "./.data/db:/var/lib/mysql" | ||
environment: | ||
- "MYSQL_ROOT_PASSWORD=root" | ||
- "MYSQL_USER=devops" | ||
- "MYSQL_PASSWORD=devops" | ||
- "MYSQL_DATABASE=demo_meetup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
nginx: | ||
image: nginx | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- ".:/home/docker" | ||
- "./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro" | ||
networks: | ||
- demo_meetup | ||
|
||
php: | ||
build: | ||
context: docker/ | ||
volumes: | ||
- "./src:/home/docker" | ||
- "./docker/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro" | ||
networks: | ||
- demo_meetup | ||
|
||
db: | ||
image: mysql | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- "./.data/db:/var/lib/mysql" | ||
networks: | ||
- demo_meetup | ||
environment: | ||
- "MYSQL_ROOT_PASSWORD=root" | ||
- "MYSQL_USER=devops" | ||
- "MYSQL_PASSWORD=devops" | ||
- "MYSQL_DATABASE=demo_meetup" | ||
|
||
# phpmyadmin: | ||
# image: phpmyadmin/phpmyadmin | ||
# ports: | ||
# - "8080:80" | ||
# networks: | ||
# - demo_meetup | ||
# environment: | ||
# - "PMA_HOST=db" | ||
# - "PMA_USER=root" | ||
# - "PMA_PASSWORD=root" | ||
|
||
networks: | ||
demo_meetup: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM php:7.1-fpm | ||
|
||
# Install packages | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
libicu-dev \ | ||
zlib1g-dev | ||
|
||
# Install mysql php driver | ||
RUN docker-php-ext-install \ | ||
mysqli \ | ||
pdo_mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
server { | ||
listen 80; | ||
|
||
root /home/docker; | ||
|
||
location / { | ||
try_files $uri @rewriteapp; | ||
} | ||
|
||
location @rewriteapp { | ||
rewrite ^(.*)$ /index.php/$1 last; | ||
} | ||
|
||
location ~ ^/(index)\.php(/|$) { | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_pass php:9000; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
} | ||
|
||
error_log /dev/fd/1; | ||
access_log /dev/fd/1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
date.timezone = Europe/Paris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
$bdd = new PDO('mysql:host=db;dbname=demo_meetup', 'root', 'root'); | ||
|
||
var_dump($bdd); | ||
|
||
// try to visit http://localhost:8080 | ||
// you see an PDO object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Demo repository for meetup docker_101 |