Skip to content

Commit

Permalink
feat: running inside docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zexi committed Dec 4, 2023
1 parent 537da0c commit 6cd4347
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
.PHONY: build

docker-yarn:
./tools/run-in-docker.sh

# check: https://docusaurus.io/docs/i18n/tutorial
write-en-translation:
yarn write-translations --locale en

serve:
start:
npm run start

serve-en:
docker-start:
./tools/run-in-docker.sh start --host 0.0.0.0

start-en:
npm run start -- --locale en

docker-start-en:
./tools/run-in-docker.sh start --host 0.0.0.0 --locale en

build:
yarn build

docker-build:
./tools/run-in-docker.sh build

build-serve: build
cd ./build/ && python3 -m http.server 8002

Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,24 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern sta

```
$ yarn
# or install packages by using container
$ make docker-yarn
```

### Local Development

```
$ yarn start
# or run inside container
$ make docker-start
# english i18n
$ make start-en
# or
$ make docker-start-en
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
Expand All @@ -20,6 +32,9 @@ This command starts a local development server and opens up a browser window. Mo

```
$ yarn build
# or build by using container
$ make docker-build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
Expand Down
5 changes: 5 additions & 0 deletions tools/run-in-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash -x

docker run --rm -ti -v $(pwd):/website -w /website \
--publish 3000:3000 \
--entrypoint yarn node:21.3.0-alpine3.17 "$@" # start --host 0.0.0.0

0 comments on commit 6cd4347

Please sign in to comment.