Skip to content

Commit 37ba7da

Browse files
committed
Install & use nodemon for dev
1 parent ed86900 commit 37ba7da

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

.diploi/helm/app.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ spec:
5757
ports:
5858
- containerPort: 8000
5959
{{- if eq .Values.stage "development" }}
60-
command: ["/app/{{ .Values.identifier }}/.venv/bin/python"]
61-
args: ["src/main.py"]
60+
command: ["nodemon"]
61+
args: ["--exec", "/app/{{ .Values.identifier }}/.venv/bin/python src/main.py"]
6262
workingDir: /app/{{ .Values.identifier }}
6363
{{- end }}
6464
env:

Dockerfile.dev

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ ARG FOLDER=/app
66
COPY --chown=1000:1000 . /app
77
WORKDIR ${FOLDER}
88

9+
# Install Node.js and nodemon for easy watch mode with Python
10+
USER root
11+
RUN apt-get update \
12+
&& apt-get install -y curl \
13+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
14+
&& apt-get install -y nodejs \
15+
&& npm install -g nodemon \
16+
&& apt-get clean \
17+
&& rm -rf /var/lib/apt/lists/*
18+
919
USER 1000:1000
1020

1121
# Setup venv
@@ -15,4 +25,4 @@ EXPOSE 8000
1525
ENV PORT=8000
1626
ENV HOST="0.0.0.0"
1727

18-
CMD .venv/bin/python src/main.py
28+
CMD ["nodemon", "--exec", ".venv/bin/python src/main.py"]

0 commit comments

Comments
 (0)