Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ and this project adheres to [Semantic Version](http://semver.org/spec/v2.0.0.htm

### Removed

## [next release 2.0.0] - 13-09-2018
### Added

### Changed

* Set whole magento application in a named volume `magento` instead of using 6 volumes:

```
app-vendor
app-generated
app-var
pub-static
pub-media
integration-test-sandbox
```

* Reason: Bug when having volumes inside a file bind mount: [#26157](https://github.com/moby/moby/issues/26157#issuecomment-419722589)

### Removed

## [1.3.0] - 05-09-2018

### Changed
Expand Down
52 changes: 24 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ As a work-around for this behavior, you can put vendor or third-party library di

**Solution:**

* Use docker volumes for following directories:
* Set full magento app inside a named volume `magento`
* Synchronise only git repository files between host and container.
* Everything else is not synchronised, so performance is same as in local setups.

* vendor
* generated
* var
* pub/static
* pub/media
**How do you get the code that is not synchronised in your host?**

* Custom synchronisation of `vendor` and `generated`:
* These volumes are synchronised seamless thanks to [magento2-dockergento-console](https://github.com/ModestCoders/magento2-dockergento-console)
* See [dockergento workflow](#workflow) for a better understanding about whole development process with dockergento.
Even if not synchronised, it is needed to have magento and vendor code in your host. Not only for developing but also for xdebug.

To sync that code seamlessly, [magento2-dockergento-console](https://github.com/ModestCoders/magento2-dockergento-console) uses `docker cp` automatically when you execute relevant commands like `dockergento composer` or `dockergento start`, so you do not need to care about that.

On the other hand, for those that implement modules inside vendor, we also provide a `unison` container that watches and syncs changes in background when you develop inside vendor.

See [dockergento workflow](#workflow) for a better understanding about whole development process with dockergento.

## Preconditions

Expand Down Expand Up @@ -87,37 +89,31 @@ As a work-around for this behavior, you can put vendor or third-party library di
app-volumes:
build: ./config/docker/image/app-volumes
volumes: &appvolumes
- .:/var/www/html:delegated
- ~/.composer:/var/www/.composer:delegated
- sockdata:/sock
- app-vendor:/var/www/html/<magento_dir>/vendor
- app-generated:/var/www/html/<magento_dir>/generated
- app-var:/var/www/html/<magento_dir>/var
- pub-static:/var/www/html/<magento_dir>/pub/static
- pub-media:/var/www/html/<magento_dir>/pub/media
- integration-test-sandbox:/var/www/html/<magento_dir>/dev/tests/integration/tmp
- ~/.composer:/var/www/.composer:delegated
- sockdata:/sock
- magento:/var/www/html/<magento_dir>
- ./app:/var/www/html/<magento_dir>/app:delegated
- ./.git:/var/www/html/.git:delegated
- ./config:/var/www/html/config:delegated
- ./composer.json:/var/www/html/composer.json:delegated
- ./composer.lock:/var/www/html/composer.lock:delegated
# Add here the rest of files and folders in your git repository that you want to bind between host and container

unison:
image: modestcoders/unison:2.51.2
volumes:
- app-vendor:/var/www/html/<magento_dir>/vendor
- ./vendor:/sync/vendor
- magento:/var/www/html/<magento_dir>
- ./<magento_dir>/vendor:/sync/<magento_dir>/vendor
environment:
- SYNC_SOURCE_BASE_PATH=/sync
- SYNC_SOURCE_BASE_PATH=/sync/<magento_dir>
- SYNC_DESTINATION_BASE_PATH=/var/www/html/<magento_dir>
- SYNC_MAX_INOTIFY_WATCHES=60000
```

* `config/docker/image/app-volumes/Dockerfile`

```
RUN mkdir -p /var/www/html/<magento_dir>/vendor \
/var/www/html/<magento_dir>/generated \
/var/www/html/<magento_dir>/var \
/var/www/html/<magento_dir>/pub/static \
/var/www/html/<magento_dir>/pub/media \
/var/www/html/<magento_dir>/dev/tests/integration/tmp \
&& chown -R 1000:1000 /var/www/html/<magento_dir>
RUN mkdir -p /var/www/html/<magento_dir> && chown -R 1000:1000 /var/www/html
```

* `config/docker/image/nginx/conf/default.conf`
Expand Down
8 changes: 1 addition & 7 deletions config/docker/image/app-volumes/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
FROM alpine:latest

RUN mkdir -p /var/www/html/vendor \
/var/www/html/generated \
/var/www/html/var \
/var/www/html/pub/static \
/var/www/html/pub/media \
/var/www/html/dev/tests/integration/tmp \
&& chown -R 1000:1000 /var/www/html
RUN mkdir -p /var/www/html && chown -R 1000:1000 /var/www/html

# Keep container running until all other containers are created.
# This avoid issues when this container is started multiple times.
Expand Down
35 changes: 15 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ services:
app-volumes:
build: ./config/docker/image/app-volumes
volumes: &appvolumes
- .:/var/www/html:delegated
- ~/.composer:/var/www/.composer:delegated
- sockdata:/sock
- app-vendor:/var/www/html/vendor
- app-generated:/var/www/html/generated
- app-var:/var/www/html/var
- pub-static:/var/www/html/pub/static
- pub-media:/var/www/html/pub/media
- integration-test-sandbox:/var/www/html/dev/tests/integration/tmp
- magento:/var/www/html
- ./app:/var/www/html/app:delegated
- ./.git:/var/www/html/.git:delegated
- ./config:/var/www/html/config:delegated
- ./composer.json:/var/www/html/composer.json:delegated
- ./composer.lock:/var/www/html/composer.lock:delegated
# Add here the rest of files and folders in your git repository that you want to bind between host and container

app:
build: ./config/docker/image/nginx
Expand Down Expand Up @@ -43,10 +43,16 @@ services:
volumes:
- dbdata:/var/lib/mysql

node:
image: modestcoders/node-php:node8-php7.1
volumes: *appvolumes
depends_on:
- app-volumes

unison:
image: modestcoders/unison:2.51.2
volumes:
- app-vendor:/var/www/html/vendor
- magento:/var/www/html
- ./vendor:/sync/vendor
environment:
- SYNC_SOURCE_BASE_PATH=/sync
Expand All @@ -56,18 +62,7 @@ services:
- app-volumes
privileged: true

node:
image: modestcoders/node-php:node8-php7.1
volumes: *appvolumes
depends_on:
- app-volumes

volumes:
dbdata:
sockdata:
app-vendor:
app-generated:
app-var:
pub-static:
pub-media:
integration-test-sandbox:
magento: