Skip to content

Commit 7b11449

Browse files
authored
add support of compose watch for Docker Desktop walkthroughs (#7)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
1 parent d3b2a9c commit 7b11449

File tree

5 files changed

+625
-140
lines changed

5 files changed

+625
-140
lines changed

app/Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,21 @@ WORKDIR /usr/src/app
2121
RUN --mount=type=bind,source=package.json,target=package.json \
2222
--mount=type=bind,source=package-lock.json,target=package-lock.json \
2323
--mount=type=cache,target=/root/.npm \
24-
npm ci --omit=dev
24+
npm ci --include=dev
2525

26-
# Run the application as a non-root user.
27-
USER node
26+
# install nodemon for hot-reloading
27+
RUN npm install -g nodemon
2828

2929
# Copy the rest of the source files into the image.
3030
COPY . .
3131

32+
33+
# Run the application as a non-root user.
34+
RUN chown -R node /usr/src/app
35+
USER node
36+
3237
# Expose the port that the application listens on.
3338
EXPOSE 3000
3439

35-
# Run the application.
36-
CMD npm start
40+
# Run the application in dev mode to use with Compose watch feature
41+
CMD npm run dev

0 commit comments

Comments
 (0)