Skip to content

Commit 1ac762a

Browse files
feat(devcontainer): Auto-reload on file change
When the userscript is rebuilt, the web server in the dev container now automatically refreshes the page.
1 parent 66f7441 commit 1ac762a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/kittensgame/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ FROM docker.io/library/node:20.10.0-bookworm@sha256:445acd9b2ef7e9de665424053bf9
33
ARG BRANCH=master
44

55
EXPOSE 8080
6+
EXPOSE 8086
67

7-
RUN git clone https://github.com/nuclear-unicorn/kittensgame.git \
8+
RUN git clone --branch $BRANCH --single-branch https://github.com/nuclear-unicorn/kittensgame.git \
89
&& cd kittensgame \
9-
&& git checkout $BRANCH \
10+
&& yarn add -D watch-http-server \
1011
&& yarn install
1112

1213
# Copy the script that injects kitten-scientists.inject.js into index.html and execute it.
@@ -16,4 +17,4 @@ COPY "inject-scientists.js" "inject-scientists.js"
1617
RUN node inject-scientists.js
1718

1819
# Start the development server that serves the Kittens Game.
19-
CMD [ "/bin/bash", "-c", "yarn start" ]
20+
CMD [ "/bin/bash", "-c", "yarn run watch-http-server" ]

packages/kittensgame/scripts/run-development-container.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ main() {
2727
--detach \
2828
--mount type=bind,source="${BASEDIR}/../../kitten-scientists/output",target=/kittensgame/kitten-scientists \
2929
--name kittensgame \
30+
--publish 8086:8086 \
3031
--publish 8100:8080 \
3132
kittensgame
3233
echo "Container started."

0 commit comments

Comments
 (0)