├── 1
├── Dockerfiles
│ ├── Dockerfile
│ ├── Dockerfile_long
│ ├── Dockerfile_nginx
│ └── Dockerfile_nginx_0
├── hello
│ ├── hello.py
│ └── long.py
├── nginx
│ ├── Dockerfile
│ ├── custom.conf
│ └── index.html
└── redis
│ └── 123
└── 2
├── Dockerfiles
├── Dockerfile
└── Dockerfile_ideal
├── compose
├── docker-compose.production.yml
├── docker-compose.test.yml
├── docker-compose.yml
├── nginx
│ ├── Dockerfile
│ ├── custom.conf
│ └── www
│ │ ├── index.html
│ │ └── phpinfo
│ │ └── index.php
├── php
│ ├── Dockerfile
│ └── www
│ │ ├── index.html
│ │ └── phpinfo
│ │ └── index.php
├── test
│ ├── Dockerfile
│ └── docker-entrypoint.sh
└── www
│ ├── index.html
│ └── phpinfo
│ └── index.php
└── size
├── .dockerignore
├── app
└── index.html
└── custom.conf
/1/Dockerfiles/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.6
2 |
3 | RUN mkdir /opt/app
4 | WORKDIR /opt/app
5 |
6 | COPY hello.py /opt/app
7 |
8 | CMD ["python", "hello.py"]
9 |
--------------------------------------------------------------------------------
/1/Dockerfiles/Dockerfile_long:
--------------------------------------------------------------------------------
1 | FROM python:3.6
2 |
3 | RUN mkdir /opt/app
4 | WORKDIR /opt/app
5 |
6 | COPY long.py /opt/app
7 |
8 | CMD ["python", "long.py"]
9 |
--------------------------------------------------------------------------------
/1/Dockerfiles/Dockerfile_nginx:
--------------------------------------------------------------------------------
1 | FROM nginx
2 |
3 | COPY index.html /usr/share/nginx/html
4 | ADD custom.conf /etc/nginx/conf.d/
5 |
6 | EXPOSE 80
7 |
8 | ENV FOO bar
9 |
10 | CMD ["nginx", "-g", "daemon off;"]
11 |
--------------------------------------------------------------------------------
/1/Dockerfiles/Dockerfile_nginx_0:
--------------------------------------------------------------------------------
1 | FROM nginx
2 |
3 | COPY index.html /usr/share/nginx/html
4 |
5 | EXPOSE 80
6 |
7 | CMD ["nginx", "-g", "daemon off;"]
8 |
--------------------------------------------------------------------------------
/1/hello/hello.py:
--------------------------------------------------------------------------------
1 | print("It's work!")
2 |
--------------------------------------------------------------------------------
/1/hello/long.py:
--------------------------------------------------------------------------------
1 | import time
2 | import datetime
3 |
4 | while True:
5 | print (str(datetime.datetime.now()))
6 | time.sleep (2)
7 |
--------------------------------------------------------------------------------
/1/nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx
2 |
3 | COPY index.html /usr/share/nginx/html
4 | ADD custom.conf /etc/nginx/conf.d/
5 |
6 | EXPOSE 80
7 |
8 | ENV FOO bar
9 |
10 | CMD ["nginx", "-g", "daemon off;"]
11 |
--------------------------------------------------------------------------------
/1/nginx/custom.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name docker.marsel.host;
4 |
5 | location / {
6 | root /usr/share/nginx/html;
7 | index index.html index.htm;
8 | }
9 |
10 | location /test {
11 | return 200 '$hostname\n';
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/1/nginx/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 | I am Nginx!
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/1/redis/123:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IbraevM/docker_practice/b4578a2c87a363db90d81a2c05ed3bb1541102b5/1/redis/123
--------------------------------------------------------------------------------
/2/Dockerfiles/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM debian
2 |
3 | COPY . /opt/
4 |
5 | RUN apt-get update
6 | RUN apt-get install -y nginx
7 |
8 | COPY custom.conf /etc/nginx/conf.d/
9 |
10 | EXPOSE 80
11 |
12 | CMD ["nginx", "-g", "daemon off;"]
13 |
--------------------------------------------------------------------------------
/2/Dockerfiles/Dockerfile_ideal:
--------------------------------------------------------------------------------
1 | FROM alpine:3.11.5
2 |
3 | ENV NGINX_VERSION 1.16
4 |
5 | RUN apk add --no-cache nginx-${NGINX_VERSION} && mkdir -p /run/nginx
6 |
7 | EXPOSE 80
8 |
9 | COPY custom.conf /etc/nginx/conf.d/
10 | COPY . /opt/
11 |
12 | CMD ["nginx", "-g", "daemon off;"]
13 |
--------------------------------------------------------------------------------
/2/compose/docker-compose.production.yml:
--------------------------------------------------------------------------------
1 | version: "2.3"
2 | services:
3 | nginx:
4 | image: compose_nginx
5 | ports:
6 | - "80:80"
7 | depends_on:
8 | php:
9 | condition: service_healthy
10 | environment:
11 | - ENV=production
12 | php:
13 | image: compose_php
14 | healthcheck:
15 | test: ["CMD", "php-fpm", "-t"]
16 | interval: 3s
17 | timeout: 5s
18 | retries: 5
19 | start_period: 1s
20 |
--------------------------------------------------------------------------------
/2/compose/docker-compose.test.yml:
--------------------------------------------------------------------------------
1 | version: "2.3"
2 | services:
3 | test:
4 | build: ./test
5 | depends_on:
6 | - php
7 | - nginx
8 |
--------------------------------------------------------------------------------
/2/compose/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "2.3"
2 | services:
3 | nginx:
4 | build: ./nginx
5 | ports:
6 | - "80:80"
7 | volumes:
8 | - ./www:/var/www
9 | depends_on:
10 | php:
11 | condition: service_healthy
12 | environment:
13 | - ENV=development
14 | php:
15 | build: ./php
16 | volumes:
17 | - ./www:/var/www
18 | healthcheck:
19 | test: ["CMD", "php-fpm", "-t"]
20 | interval: 3s
21 | timeout: 5s
22 | retries: 5
23 | start_period: 1s
24 |
--------------------------------------------------------------------------------
/2/compose/nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine:3.11.5
2 |
3 | RUN apk add --no-cache nginx && mkdir -p /run/nginx
4 |
5 | EXPOSE 80
6 |
7 | COPY custom.conf /etc/nginx/conf.d/
8 |
9 | COPY ./www/ /var/www/
10 |
11 | CMD ["nginx", "-g", "daemon off;"]
12 |
--------------------------------------------------------------------------------
/2/compose/nginx/custom.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name docker.marsel.host;
4 |
5 | root /var/www;
6 |
7 | index index.html index.php;
8 |
9 | location ~ \.php$ {
10 | try_files $uri =404;
11 | fastcgi_split_path_info ^(.+\.php)(/.+)$;
12 | fastcgi_pass php:9000;
13 | fastcgi_index index.php;
14 | include fastcgi_params;
15 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
16 | fastcgi_param PATH_INFO $fastcgi_path_info;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/2/compose/nginx/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 | I am Nginx!!!
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/2/compose/nginx/www/phpinfo/index.php:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/2/compose/php/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.4-fpm
2 |
3 | EXPOSE 9000
4 |
5 | WORKDIR /var/www
6 |
7 | COPY ./www/ /var/www/
8 |
9 | CMD ["php-fpm"]
10 |
--------------------------------------------------------------------------------
/2/compose/php/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 | I am Nginx!!!
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/2/compose/php/www/phpinfo/index.php:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/2/compose/test/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine:3.11.5
2 |
3 | RUN apk add --no-cache curl
4 |
5 | COPY docker-entrypoint.sh /
6 |
7 | ENTRYPOINT ["/docker-entrypoint.sh"]
8 |
--------------------------------------------------------------------------------
/2/compose/test/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo -en "\033[37;1;42m Check start page: \033[0m"
4 |
5 | curl -H "Host: docker.marsel.host" --silent --show-error --fail -I http://nginx/
6 |
7 | echo -e "---------\n"
8 |
9 | sleep 1
10 |
11 | echo -en "\033[37;1;42m Check PHP_FPM work: \033[0m"
12 |
13 | curl -H "Host: docker.marsel.host" --silent --show-error --fail -I http://nginx/phpinfo/
14 |
--------------------------------------------------------------------------------
/2/compose/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 | I am Nginx!!!
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/2/compose/www/phpinfo/index.php:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/2/size/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 | Dockerfile
3 |
--------------------------------------------------------------------------------
/2/size/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 | I am Nginx!!!
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/2/size/custom.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name docker.marsel.host;
4 |
5 | location / {
6 | root /opt/app;
7 | index index.html index.htm;
8 | }
9 |
10 | location /test {
11 | return 200 '$hostname\n';
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------