forked from TracecatHQ/tracecat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
73 lines (58 loc) · 2.52 KB
/
Dockerfile.dev
File metadata and controls
73 lines (58 loc) · 2.52 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM ghcr.io/astral-sh/uv:0.9.7-python3.12-bookworm-slim
# Define the environment variables
ENV HOST=0.0.0.0
ENV PORT=8000
# Install packages
COPY scripts/install-packages.sh .
RUN chmod +x install-packages.sh && \
./install-packages.sh && \
rm install-packages.sh
# Set deno environment variables to use pre-cached modules
ENV DENO_DIR="/root/.deno"
ENV NODE_MODULES_DIR="/app/node_modules"
ENV NODE_ENV="development"
# Set temporary directory environment variables (for development)
ENV TMPDIR="/tmp"
ENV TEMP="/tmp"
ENV TMP="/tmp"
# Set the working directory inside the container
WORKDIR /app
# Prime uv's dependency cache using the lockfile before copying the working tree.
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=packages,target=packages \
uv sync --locked --no-install-project --no-dev --no-editable
# Copy the application files into the container
COPY ./tracecat /app/tracecat
COPY ./packages/tracecat-registry /app/packages/tracecat-registry
COPY ./packages/tracecat-ee /app/packages/tracecat-ee
COPY ./pyproject.toml /app/pyproject.toml
COPY ./uv.lock /app/uv.lock
COPY ./.python-version /app/.python-version
COPY ./README.md /app/README.md
COPY ./LICENSE /app/LICENSE
COPY ./alembic.ini /app/alembic.ini
COPY ./alembic /app/alembic
COPY scripts/entrypoint.sh /app/entrypoint.sh
COPY scripts/check_tmp.py /usr/local/bin/check_tmp.py
RUN chmod +x /app/entrypoint.sh && chmod +x /usr/local/bin/check_tmp.py
# Materialize the venv while reusing the warmed cache for faster dev rebuilds.
RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-dev
# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"
# Ensure uv binary is available where Ray expects it
RUN mkdir -p /root/.local/bin && \
ln -s $(which uv) /root/.local/bin/uv
# Create necessary directories for development
RUN mkdir -p /root/.deno /app/node_modules /app/.scripts && \
# Copy pre-cached deno modules if they exist
cp -r /opt/deno-cache/* /root/.deno/ 2>/dev/null || true && \
# Copy node_modules if they exist
cp -r /opt/node_modules/* /app/node_modules/ 2>/dev/null || true && \
# Clean up
rm -rf /opt/deno-cache /opt/node_modules
ENTRYPOINT ["/app/entrypoint.sh"]
EXPOSE $PORT
# Command to run the application. This uses the venv python.
CMD ["sh", "-c", "python3 -m uvicorn tracecat.api.app:app --host $HOST --port $PORT --reload"]