Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile + docker-compose.yaml build/running #93

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -62,20 +62,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 @@ -84,18 +90,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