Skip to content

Commit

Permalink
Merge pull request #93 from marcellodesales/bugfix/dockerfile-docker-…
Browse files Browse the repository at this point in the history
…compose-builder

Dockerfile + docker-compose.yaml build/running
  • Loading branch information
geriom committed Feb 5, 2021
2 parents f96057c + b23fd04 commit 18f9ce1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM klakegg/hugo:0.78.2-asciidoctor

RUN apk add git
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,26 @@ hugo server
You can run docsy-example inside a [Docker](ihttps://docs.docker.com/)
container, the container runs with a volume bound to the `docsy-example`
folder. This approach doesn't require you to install any dependencies other
than Docker.
than Docker and Docker Compose.

> Reference: https://docs.docker.com/compose/gettingstarted/
1. Build the docker image

```bash
docker build -f dev.Dockerfile -t docsy-example-dev:latest .
docker-compose build
```

1. Run the built image

```bash
docker run --publish 1313:1313 --detach --mount src="$(pwd)",target=/home/docsy/app,type=bind docsy-example-dev:latest
docker-compose up
```

> NOTE: You can run both commands at once as `docker-compose up --build` while you are working.
1. Verify work

Open your web browser and type `http://localhost:1313` in your navigation bar,
This opens a local instance of the docsy-example homepage. You can now make
changes to the docsy example and those changes will immediately show up in your
Expand All @@ -72,18 +78,15 @@ browser after you save.
To stop the container, first identify the container ID with:

```bash
docker container ls
CTRL + C to terminate `docker-compose` process
```

Take note of the hexadecimal string below the `CONTAINER ID` column, then stop
the container:
That will terminate the container.

```bash
docker stop [container_id]
```
1. Remove produced images

To delete the container run:
You can execute `rm` to remove the produced images

```
docker container rm [container_id]
```console
docker-compose rm
```
8 changes: 0 additions & 8 deletions dev.Dockerfile

This file was deleted.

13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.3"

services:

site:
image: docsy/docsy-example
build:
context: .
command: server
ports:
- "1313:1313"
volumes:
- .:/src

0 comments on commit 18f9ce1

Please sign in to comment.