Skip to content

Commit 70bca02

Browse files
committed
Try out a simplier approach
1 parent 4252358 commit 70bca02

2 files changed

Lines changed: 11 additions & 35 deletions

File tree

.diploi/helm/app.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ spec:
4242
args:
4343
- |
4444
uv venv .venv --clear
45+
if [ -f pyproject.toml ]; then
46+
uv pip install -e .
47+
elif [ -f requirements.txt ]; then
48+
uv pip install -r requirements.txt
49+
fi
4550
workingDir: /app{{ .Values.folder }}
4651
volumeMounts:
4752
- name: app-mount

Dockerfile.dev

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
1-
# Use a Python image with uv pre-installed
21
FROM ghcr.io/astral-sh/uv:python3.11-bookworm
32

43
# This will be set by the GitHub action to the folder containing this component.
54
ARG FOLDER=/app
65

7-
COPY --chown=1000:1000 . /app
8-
WORKDIR ${FOLDER}
6+
RUN mkdir /app && chown 1000:1000 /app
7+
WORKDIR /app
98

10-
# Enable bytecode compilation
11-
ENV UV_COMPILE_BYTECODE=1
12-
13-
# Ensure installed tools can be executed out of the box
14-
ENV UV_TOOL_BIN_DIR=/usr/local/bin
15-
16-
# Fix uv + non-root environment
17-
ENV HOME=/tmp
18-
ENV XDG_DATA_HOME=/tmp/.local/share
19-
ENV XDG_CACHE_HOME=/tmp/.cache
20-
21-
USER root
22-
RUN apt-get update && apt-get install -y nodejs npm \
23-
&& npm install -g nodemon \
24-
&& rm -rf /var/lib/apt/lists/*
25-
26-
# Allow uv to use cache
27-
RUN mkdir -p /.cache/uv && chown 1000:1000 /.cache /.cache/uv
9+
ENV PATH="$FOLDER/.venv/bin:$PATH"
10+
ENV PORT=8000
11+
ENV HOST="0.0.0.0"
2812

2913
USER 1000:1000
30-
31-
# Reset the entrypoint, don't invoke `uv`
32-
ENTRYPOINT []
33-
3414
EXPOSE 8000
35-
ENV PORT=8000
36-
ENV HOST="0.0.0.0"
3715

38-
CMD ["/usr/local/bin/nodemon", \
39-
"--delay", "1", \
40-
"--watch", "pyproject.toml", \
41-
"--watch", "requirements.txt", \
42-
"--watch", ".venv/lib/*", \
43-
"--watch", ".venv/lib64/*", \
44-
"--exec", "sh -c 'if [ -f pyproject.toml ]; then uv run --isolated --with . --with uvicorn uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir src --reload-exclude \".venv/**\"; elif [ -f requirements.txt ]; then uv run --isolated --with-requirements requirements.txt --with uvicorn uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir src --reload-exclude \".venv/**\"; else uv run --isolated --with uvicorn uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir src --reload-exclude \".venv/**\"; fi'", \
45-
"--"]
16+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload", "--reload-dir", "src"]

0 commit comments

Comments
 (0)