Skip to content

Commit 42d0264

Browse files
authored
Migrate to Compose 3.3 (#89)
1 parent d923526 commit 42d0264

File tree

11 files changed

+41
-89
lines changed

11 files changed

+41
-89
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ You can use NoDock for simple projects by using one of the [examples](#Examples)
4343
<a name="Requirements"></a>
4444
## Requirements
4545

46-
* [Docker Engine 1.12+](https://docs.docker.com/engine/installation/)
46+
* [Docker Engine 17.06+](https://docs.docker.com/engine/installation/)
4747
* [Docker Compose 1.8+](https://docs.docker.com/compose/install/)
4848

4949
<a name="Installation"></a>
@@ -176,7 +176,15 @@ To add more node containers, simply add the following to your `docker-compose.ov
176176
# docker-compose.override.yml
177177
[...]
178178
node2: # name of new container
179-
extends: node # extends the settings from the "node" container
179+
build: # reuse the same values from the node service, cannot use extends in docker-compose 3+
180+
context: ./node
181+
args:
182+
- NODE_VERSION=latest
183+
- PROJECT_PATH=/opt/app/
184+
- NODE_ENV=production
185+
- YARN=false
186+
volumes:
187+
- ../:/opt/app
180188
entrypoint: run-nodock "node alternate.js" # the entrypoint for the "node2" container
181189
nginx:
182190
ports:

_examples/2-nodes/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Copy all the files in this folder to the project root:
77
```bash
88
cd <project_folder>/
99

10-
cp -r nodock/_examples/multiple-node/* .
10+
cp -r nodock/_examples/2-nodes/* .
1111
mv docker-compose.override.yml nodock/
1212
mv node2.conf nodock/nginx/sites/
1313
```
@@ -20,4 +20,4 @@ cd nodock/
2020
docker-compose up -d node node2 nginx
2121
```
2222

23-
By going to `127.0.0.1` in your browser you should be seeing a nice greeting! By going to `127.0.0.1:10000` in your browser you should be seeing _another_ nice greeting!
23+
By going to `127.0.0.1` in your browser you should be seeing a nice greeting! By going to `127.0.0.1:10000` in your browser you should be seeing _another_ nice greeting!
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# docker-compose.override.yml
22

3-
version: '2'
3+
version: '3.3'
44

55
services:
66
node2: # name of new container
7-
extends: node # extends the settings from the "node" container
87
build:
98
context: ./node
109
args:
10+
- NODE_VERSION=latest
1111
- PROJECT_PATH=second-app
12+
- NODE_ENV=production
13+
- YARN=false
14+
volumes:
15+
- ../:/opt/app
1216
entrypoint: run-nodock "node index.js" # the entrypoint for the "node2" container
17+
1318
nginx:
1419
ports:
1520
- "10000:10000" # the port(s) to forward for the "node2" container
1621
links:
17-
- node2 # link "nginx" to "node2"
22+
- node2 # link "nginx" to "node2"

_examples/rabbitmq/README.md

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

_examples/rabbitmq/index.js

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

_examples/rabbitmq/package.json

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

apache/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ RUN mkdir /usr/local/apache2/templates \
77
&& mkdir /usr/local/apache2/sites-available \
88
&& rm /usr/local/apache2/conf/httpd.conf \
99
&& rm /usr/local/apache2/conf/extra/*.conf
10-
ADD httpd.conf /usr/local/apache2/conf
10+
11+
COPY httpd.conf /usr/local/apache2/conf/httpd.conf
1112

1213
COPY scripts /root/scripts/
13-
COPY certs/* /etc/ssl/
14+
COPY certs /etc/ssl/
1415

1516
COPY sites /usr/local/apache2/templates
1617

apache/certs/.gitkeep

Whitespace-only changes.

apache/httpd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ServerRoot "/usr/local/apache2"
22

3+
LoadModule mpm_event_module modules/mod_mpm_event.so
34
LoadModule authn_file_module modules/mod_authn_file.so
45
LoadModule authn_core_module modules/mod_authn_core.so
56
LoadModule authz_host_module modules/mod_authz_host.so
@@ -28,7 +29,6 @@ LoadModule alias_module modules/mod_alias.so
2829
<IfModule unixd_module>
2930
User www-data
3031
Group www-data
31-
3232
</IfModule>
3333

3434
ServerAdmin [email protected]

docker-compose.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2'
1+
version: '3.3'
22

33
services:
44

@@ -23,17 +23,17 @@ services:
2323
- MYSQL_USER=default_user
2424
- MYSQL_PASSWORD=secret
2525
- MYSQL_ROOT_PASSWORD=root
26-
volumes_from:
27-
- volumes
26+
volumes:
27+
- ./data/mysql/:/var/lib/mysql
2828
expose:
2929
- "3306"
3030

3131
mongo:
3232
build: ./mongo
3333
expose:
3434
- "27017"
35-
volumes_from:
36-
- volumes
35+
volumes:
36+
- ./data/mongo/:/var/lib/mongodb
3737

3838
nginx:
3939
build:
@@ -43,8 +43,9 @@ services:
4343
- WEB_SSL=false
4444
- SELF_SIGNED=false
4545
- NO_DEFAULT=false
46-
volumes_from:
47-
- volumes
46+
volumes:
47+
- ./data/logs/nginx/:/var/log/nginx
48+
- ./certbot/certs/:/var/certs
4849
ports:
4950
- "80:80"
5051
- "443:443"
@@ -58,8 +59,9 @@ services:
5859
- WEB_SSL=false
5960
- SELF_SIGNED=false
6061
- NO_DEFAULT=false
61-
volumes_from:
62-
- volumes
62+
volumes:
63+
- ./data/logs/apache/:/usr/local/apache2/logs
64+
- ./certbot/certs/:/var/certs
6365
ports:
6466
- "80:80"
6567
- "443:443"
@@ -71,8 +73,9 @@ services:
7173
links:
7274
- apache
7375
- nginx
74-
volumes_from:
75-
- volumes
76+
volumes:
77+
- ./certbot/letsencrypt/:/var/www/letsencrypt
78+
- ./certbot/certs/:/var/certs
7679

7780
rabbitmq:
7881
build:
@@ -95,14 +98,10 @@ services:
9598
- nginx
9699
volumes:
97100
- ../:/opt/app
98-
volumes_from:
99-
- volumes
100101

101102
memcached:
102103
build:
103104
context: ./memcached
104-
volumes_from:
105-
- volumes
106105
expose:
107106
- "11211"
108107

@@ -116,13 +115,3 @@ services:
116115
- "29015"
117116
ports:
118117
- "28080:8080"
119-
120-
volumes:
121-
image: tianon/true
122-
volumes:
123-
- ./certbot/letsencrypt/:/var/www/letsencrypt
124-
- ./certbot/certs/:/var/certs
125-
- ./data/mysql:/var/lib/mysql
126-
- ./data/mongo:/var/lib/mongodb
127-
- ./data/logs/nginx/:/var/log/nginx
128-
- ./data/logs/apache/:/usr/local/apache2/logs

0 commit comments

Comments
 (0)