| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
|
|
| ARG BASE_IMAGE=ghcr.io/meta-pytorch/openenv-base:latest |
| FROM ${BASE_IMAGE} AS builder |
|
|
| WORKDIR /app |
|
|
| |
| ARG OSS_CAD_SUITE_VERSION=20260407 |
| ARG TARGETARCH |
|
|
| |
| RUN apt-get update && \ |
| apt-get install -y --no-install-recommends git perl perl-modules-5.40 && \ |
| rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN set -eux; \ |
| case "${TARGETARCH}" in \ |
| arm64) asset_arch=arm64 ;; \ |
| amd64) asset_arch=x64 ;; \ |
| *) echo "Unsupported target architecture: ${TARGETARCH}" && exit 1 ;; \ |
| esac; \ |
| archive="/tmp/oss-cad-suite.tgz"; \ |
| curl -fsSL -o "${archive}" \ |
| "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2026-04-07/oss-cad-suite-linux-${asset_arch}-${OSS_CAD_SUITE_VERSION}.tgz"; \ |
| top_level_dir="$(tar -tzf "${archive}" | head -n 1 | cut -d/ -f1)"; \ |
| tar -xzf "${archive}" -C /opt; \ |
| if [ "${top_level_dir}" != "oss-cad-suite" ]; then \ |
| mv "/opt/${top_level_dir}" /opt/oss-cad-suite; \ |
| fi; \ |
| rm -f "${archive}" |
|
|
| |
| ARG BUILD_MODE=in-repo |
| ARG ENV_NAME=chipforge |
|
|
| |
| COPY . /app/env |
|
|
| |
| |
| WORKDIR /app/env |
|
|
| |
| RUN if ! command -v uv >/dev/null 2>&1; then \ |
| curl -LsSf https://astral.sh/uv/install.sh | sh && \ |
| mv /root/.local/bin/uv /usr/local/bin/uv && \ |
| mv /root/.local/bin/uvx /usr/local/bin/uvx; \ |
| fi |
| |
| |
| |
| RUN --mount=type=cache,target=/root/.cache/uv \ |
| if [ -f uv.lock ]; then \ |
| uv sync --frozen --no-install-project --no-editable; \ |
| else \ |
| uv sync --no-install-project --no-editable; \ |
| fi |
|
|
| RUN --mount=type=cache,target=/root/.cache/uv \ |
| if [ -f uv.lock ]; then \ |
| uv sync --frozen --no-editable; \ |
| else \ |
| uv sync --no-editable; \ |
| fi |
|
|
| |
| FROM ${BASE_IMAGE} |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && \ |
| apt-get install -y --no-install-recommends g++ make perl perl-modules-5.40 && \ |
| rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY --from=builder /opt/oss-cad-suite /opt/oss-cad-suite |
|
|
| |
| COPY --from=builder /app/env/.venv /app/.venv |
|
|
| |
| COPY --from=builder /app/env /app/env |
|
|
| |
| ENV PATH="/opt/oss-cad-suite/bin:/app/.venv/bin:$PATH" |
|
|
| |
| ENV PYTHONPATH="/app/env:$PYTHONPATH" |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ |
| CMD curl -f http://localhost:8000/health || exit 1 |
|
|
| |
| |
| ENV ENABLE_WEB_INTERFACE=true |
| CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"] |
|
|