-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
47 lines (35 loc) · 1.35 KB
/
Dockerfile.dev
File metadata and controls
47 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.11-bookworm
# This will be set by the GitHub action to the folder containing this component.
ARG FOLDER=/app
COPY --chown=1000:1000 . /app
WORKDIR ${FOLDER}
# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1
# Ensure installed tools can be executed out of the box
ENV UV_TOOL_BIN_DIR=/usr/local/bin
# Place executables in the environment at the front of the path
ENV PATH="$FOLDER/.venv/bin:$PATH"
# Fix uv + non-root environment
ENV HOME=/tmp
ENV XDG_DATA_HOME=/tmp/.local/share
ENV XDG_CACHE_HOME=/tmp/.cache
USER root
RUN apt-get update && apt-get install -y nodejs npm \
&& npm install -g nodemon \
&& rm -rf /var/lib/apt/lists/*
# Allow uv to use cache
RUN mkdir -p /.cache/uv && chown 1000:1000 /.cache /.cache/uv
USER 1000:1000
EXPOSE 8000
ENV PORT=8000
ENV HOST="0.0.0.0"
ENTRYPOINT ["/usr/local/bin/nodemon"]
CMD ["--delay", "1", \
"--watch", "pyproject.toml", \
"--watch", "requirements.txt", \
"--watch", ".venv/lib/*", \
"--watch", ".venv/lib64/*", \
"--watch", "src", \
"--ext", "py", \
"--exec", "sh -c 'if [ -f pyproject.toml ]; then uv run --isolated --with . python src/main.py; elif [ -f requirements.txt ]; then uv run --isolated --with-requirements requirements.txt python src/main.py; else uv run --isolated python src/main.py; fi'"]