Spaces:
Paused
Paused
| FROM ubuntu:22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # ---- system deps ---- | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| make \ | |
| curl \ | |
| ca-certificates \ | |
| pkg-config \ | |
| libudev-dev \ | |
| libsystemd-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ---- install uv ---- | |
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | |
| ENV PATH=/root/.local/bin:$PATH | |
| # ---- install Python via uv ---- | |
| ARG PYTHON_VERSION=3.12.12 | |
| RUN uv python install ${PYTHON_VERSION} | |
| # ---- clone Opentrons repo ---- | |
| # You can pin a tag/branch/commit with OPENTRONS_REF | |
| ARG OPENTRONS_REF=edge | |
| WORKDIR /root | |
| RUN git clone https://github.com/Opentrons/opentrons.git /root/opentrons \ | |
| && cd /root/opentrons \ | |
| && git checkout ${OPENTRONS_REF} | |
| WORKDIR /root/opentrons | |
| # ---- robot-server setup (use uv-managed python) ---- | |
| RUN test -d robot-server | |
| RUN uv run --python ${PYTHON_VERSION} make -C robot-server setup | |
| # ---- (optional) your app layer ---- | |
| # If you also want to copy YOUR gradio app into the image, keep these lines. | |
| # Otherwise you can delete everything below and just run robot-server related commands. | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # cache-friendly deps install | |
| COPY --chown=user requirements.txt $HOME/app/requirements.txt | |
| RUN uv venv --python ${PYTHON_VERSION} .venv \ | |
| && uv pip install --python .venv/bin/python -r requirements.txt | |
| COPY --chown=user . $HOME/app | |
| USER root | |
| COPY entrypoint.sh /entrypoint.sh | |
| RUN chmod +x /entrypoint.sh | |
| WORKDIR /root/opentrons | |
| ENTRYPOINT ["/bin/bash", "-lc", "source /entrypoint.sh && exec \"$@\""] | |
| CMD ["bash"] | |