Skip to content

Commit

Permalink
really fix packages/halmos/Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkarmacoma committed Dec 4, 2024
1 parent b9cf162 commit 6c3af34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions packages/halmos/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
FROM ghcr.io/a16z/halmos-builder:latest

# inspired by https://hynek.me/articles/docker-uv/

# - enable the virtual environment
# - install halmos and its dependencies in UV_PROJECT_ENVIRONMENT
# - enable bytecode compilation for faster startup
# - disable downloading any additional packages
# - use copy mode for linking instead of symlinking (because we mount to /src temporarily)
ENV PATH="/halmos/.venv/bin:$PATH" \
UV_PROJECT_ENVIRONMENT='/halmos/.venv' \
ENV PATH="/halmos/bin:$PATH" \
VIRTUAL_ENV='/halmos' \
UV_PROJECT_ENVIRONMENT='/halmos' \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON=python3.13 \
UV_PYTHON_DOWNLOADS=never \
UV_LINK_MODE=copy

# Install halmos, assuming it is checked out in the current host directory
RUN --mount=type=bind,source=../..,target=/src,readonly=false \
cd /src && \
uv sync --frozen --extra dev
uv sync --frozen --extra dev --no-editable

# Set a nicer prompt
ENV IMAGE_NAME=halmos
RUN echo 'PS1="($IMAGE_NAME) \[\033[1;32m\]\u@\h \[\033[1;35m\]\w \$\[\033[0m\] "' >> /root/.bashrc

# optional: print python version, site packages, and check that halmos can be imported
RUN <<EOT
python -V
python -Im site
python -Ic 'import halmos'
EOT

WORKDIR /workspace
CMD ["uv", "run", "halmos"]
CMD ["halmos"]
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c3af34

Please sign in to comment.