Skip to content

Commit f90e6b0

Browse files
committed
feat(docker): improve docker support
This improves Docker support in the following ways: * Base image off `ruby:onbuild` to avoid unnecessary custom steps and ease derived images. * Adds `.dockerignore` to avoid sending large files to build. * Adds a `docker-compose.yml` so users can simply type `docker-compose up` to get it running. * Explicity sets the volume definition in the `Dockerfile`. * Volume is automatically mount by `docker-compose` (the `source` directory relative to the project's dir). * Workaround watcher failing to pick directory changes probably because of vboxsf and the `listen` gem failing to register filesystem changes. * Updates documentation.
1 parent b871b44 commit f90e6b0

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
source

Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
FROM ruby:2.2.3-onbuild
2-
3-
RUN ln -s /usr/src/app /app # Deprecated
4-
1+
FROM ruby:onbuild
2+
MAINTAINER Adrian Perez <adrian@adrianperez.org>
3+
VOLUME /usr/src/app/source
54
EXPOSE 4567
65
CMD ["bundle", "exec", "middleman", "server", "--force-polling"]

README.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,28 @@ You're going to need:
4747
2. Clone *your forked repository* (not our original one) to your hard drive with `git clone https://github.com/YOURUSERNAME/slate.git`
4848
3. `cd slate`
4949
4. Initialize and start (there are a few options for this):
50-
50+
5151
#### Manual/local
5252

5353
```shell
5454
bundle install
5555
bundle exec middleman server
56-
```
57-
#### Via Docker (must install Docker first)
56+
```
57+
58+
#### Via Docker (must install it first)
5859

5960
```shell
60-
docker build -t slate .
61-
docker run -d -p 4567:4567 --name slate -v $(pwd)/source:/app/source slate
62-
```
61+
docker-compose up
62+
```
63+
64+
will spin an environment for you, with the `source` directory mapped to the
65+
container, so you can see your edits instantly after refreshing your browser.
6366

64-
You can now see the docs at http://localhost:4567. Whoa! That was fast!
67+
You can now see the docs at http://localhost:4567. Whoa! That was fast!
6568

66-
*Note: if you're using the Docker setup on OSX, the docs will be availalable at the output of `boot2docker ip` instead of `localhost:4567`.*
69+
+*Note: if you're not using Docker natively (i.e. on Linux), the docs will be
70+
+available at the IP of your docker host. If you're using docker-machine you can
71+
+retrieve it with `docker-machine ip <your_machine_name>`*
6772

6873
#### Via Vagrant
6974
```shell

docker-compose.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
app:
2+
build: .
3+
ports:
4+
- 4567:4567
5+
volumes:
6+
- ./source:/usr/src/app/source

0 commit comments

Comments
 (0)