-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.yml
173 lines (148 loc) · 5.57 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
- name: DOCKER
hosts: localhost
tasks:
- name: Install required system packages
become: true
register: repo_code
apt: name={{ item }} state=latest
loop: [ 'apt-transport-https', 'lsb-release', 'python-pip', 'ca-certificates', 'curl', 'sudo', 'software-properties-common', 'python3-pip', 'virtualenv', 'python3-setuptools']
- name: Register code_changed variable
set_fact:
code_changed: repo_code.changed
- name: Add php
become: true
get_url:
url: "https://packages.sury.org/php/apt.gpg"
dest: /etc/apt/trusted.gpg.d/php.gpg
when: code_changed
- name: Add php(2)
become: true
shell: echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" >> /etc/apt/sources.list.d/php.list
when: code_changed
- name: Upgrade package
become: true
apt:
update_cache: yes
upgrade: yes
when: code_changed
- name: Install Php
become: true
apt: name={{ item }} update_cache=yes state=latest
loop: [ 'php7.3-curl', 'php7.3-gd', 'php7.3-intl', 'php7.3-json', 'php7.3-mbstring', 'php7.3-xml', 'php7.3-zip', 'php7.3', 'composer', 'python-apt' ]
when: code_changed
- name: Config Sudo
template: src=templates/sudo.j2 dest=/etc/sudoers
when: code_changed
- name: Composer install
become: yes
become_user: trr
command: sudo composer -d=/root/docker/pingouin-du-web/apps/my-symfony-app/ install
- name: Yarn install
become: true
apt_key:
url: https://dl.yarnpkg.com/debian/pubkey.gpg
state: present
- name: Yarn install(2)
become: true
shell: echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- name: Upgrade package
become: true
apt:
update_cache: yes
upgrade: yes
- name: Yarn install(3)
apt: name=yarn state=present
- name: Nodejs install
shell: curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y nodejs
- name: Yarn install cmd
become: true
command: yarn install
- name: Yarn encore dev
become: true
command: yarn encore dev
- name: ADD Docker GPG apt Key
become: true
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
when: code_changed
- name: Add Docker Repository for Debian 10
become: true
apt_repository:
repo: deb https://download.docker.com/linux/debian buster stable
state: present
when: (ansible_distribution == "Debian") and
(ansible_distribution_major_version == "10")
- name: Add Docker Repository for Debian 9
become: true
apt_repository:
repo: deb https://download.docker.com/linux/debian stretch stable
state: present
when: (ansible_distribution == "Debian") and
(ansible_distribution_major_version == "9")
- name: Update apt and install docker-ce
become: true
apt: name=docker-ce state=latest
when: code_changed
- name: Install Docker Module for Python
become: true
pip:
name: docker
when: code_changed
- name: Network
become: true
docker_network:
name: ndi
- name: MYSQL Container
become: true
docker_container:
name: mysqli
image: mysql:5
networks:
- name: ndi
restart_policy: always
state: 'started'
env:
MYSQL_USER: 'root'
MYSQL_PASSWORD: ''
MYSQL_ROOT_PASSWORD: ''
MYSQL_DATABASE: 'nightInfo'
MYSQL_PORT: '9000'
port: '9000:9000'
volumes: './data/mysql:/var/lib/mysql'
- name: PHP Image
become: true
command: docker build . -f docker/php/Dockerfile -t php
- name: PHP Container
become: true
docker_container:
name: php
hostname: php
image: php
networks:
- name: ndi
restart_policy: on-failure
state: 'started'
volumes:
- ./apps/my-symfony-app/:/usr/src/app
- ./point.env:/usr/src/app/.env
env_file: ./.env
- name: Waiting
become: true
shell: 'sleep 5 ; echo "Fin du sleep!!" '
- name: NGINX Container
become: true
docker_container:
name: nginx
image: nginx:1.15.3-alpine
networks:
- name: ndi
restart_policy: on-failure
state: 'started'
volumes:
- ./apps/my-symfony-app/:/usr/src/app
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./docker/nginx/mimes.types:/etc/nginx/conf.d/mimes.types
ports:
- "8080:80"