Skip to content

Commit 84dead8

Browse files
authored
Merge pull request #75 from google/geriom-dockerize
Add Docker image to run docsy-example locally
2 parents 2cab944 + ca1564d commit 84dead8

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,46 @@ Once you've cloned the site repo, from the repo root folder, run:
5656
```
5757
hugo server
5858
```
59+
60+
### Running a container locally
61+
62+
You can run docsy-example inside a [Docker](ihttps://docs.docker.com/)
63+
container, the container runs with a volume bound to the `docsy-example`
64+
folder. This approach doesn't require you to install any dependencies other
65+
than Docker.
66+
67+
1. Build the docker image
68+
69+
```bash
70+
docker build -f dev.Dockerfile -t docsy-example-dev:latest .
71+
```
72+
73+
1. Run the built image
74+
75+
```bash
76+
docker run --publish 1313:1313 --detach --mount src="$(pwd)",target=/home/docsy/app,type=bind docsy-example-dev:latest
77+
```
78+
79+
Open your web browser and type `http://localhost:1313` in your navigation bar,
80+
This opens a local instance of the docsy-example homepage. You can now make
81+
changes to the docsy example and those changes will immediately show up in your
82+
browser after you save.
83+
84+
To stop the container, first identify the container ID with:
85+
86+
```bash
87+
docker container ls
88+
```
89+
90+
Take note of the hexadecimal string below the `CONTAINER ID` column, then stop
91+
the container:
92+
93+
```bash
94+
docker stop [container_id]
95+
```
96+
97+
To delete the container run:
98+
99+
```
100+
docker container rm [container_id]
101+
```

dev.Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM klakegg/hugo:ext-nodejs
2+
WORKDIR /home/docsy/app
3+
RUN mkdir -p /home/docsy/deps
4+
COPY package.json /home/docsy/deps/
5+
COPY package-lock.json /home/docsy/deps/
6+
RUN cd /home/docsy/deps/ && npm install -g
7+
# COPY . .
8+
CMD [ "server" ]

0 commit comments

Comments
 (0)