baxin commited on
Commit
df7d9dd
·
verified ·
1 Parent(s): e8eeb0f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -17
Dockerfile CHANGED
@@ -15,47 +15,48 @@ RUN apt-get update \
15
  libsystemd-dev \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- # ---- install uv ----
19
- RUN curl -LsSf https://astral.sh/uv/install.sh | sh
20
- ENV PATH=/root/.local/bin:$PATH
 
 
 
 
 
 
 
21
 
22
  # ---- install Python via uv ----
23
  ARG PYTHON_VERSION=3.12.12
24
  RUN uv python install ${PYTHON_VERSION}
25
 
26
  # ---- clone Opentrons repo ----
27
- # You can pin a tag/branch/commit with OPENTRONS_REF
28
  ARG OPENTRONS_REF=edge
29
- WORKDIR /root
30
-
31
- RUN git clone https://github.com/Opentrons/opentrons.git /root/opentrons \
32
- && cd /root/opentrons \
33
- && git checkout ${OPENTRONS_REF}
34
 
35
  WORKDIR /root/opentrons
36
 
37
- # ---- robot-server setup (use uv-managed python) ----
38
- RUN test -d robot-server
39
  RUN uv run --python ${PYTHON_VERSION} make -C robot-server setup
40
 
41
- # ---- (optional) your app layer ----
42
- # If you also want to copy YOUR gradio app into the image, keep these lines.
43
- # Otherwise you can delete everything below and just run robot-server related commands.
44
-
45
  RUN useradd -m -u 1000 user
46
  USER user
47
- ENV HOME=/home/user \
48
- PATH=/home/user/.local/bin:$PATH
49
 
50
  WORKDIR $HOME/app
51
 
52
  # cache-friendly deps install
53
  COPY --chown=user requirements.txt $HOME/app/requirements.txt
 
 
54
  RUN uv venv --python ${PYTHON_VERSION} .venv \
55
  && uv pip install --python .venv/bin/python -r requirements.txt
56
 
 
57
  COPY --chown=user . $HOME/app
58
 
 
59
  USER root
60
  COPY entrypoint.sh /entrypoint.sh
61
  RUN chmod +x /entrypoint.sh
 
15
  libsystemd-dev \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # ---- install uv (system-wide) ----
19
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
20
+ && install -m 0755 /root/.local/bin/uv /usr/local/bin/uv
21
+
22
+ # Put uv-managed python somewhere world-readable
23
+ ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
24
+ ENV UV_CACHE_DIR=/opt/uv/cache
25
+
26
+ RUN mkdir -p /opt/uv/python /opt/uv/cache \
27
+ && chmod -R 755 /opt/uv
28
 
29
  # ---- install Python via uv ----
30
  ARG PYTHON_VERSION=3.12.12
31
  RUN uv python install ${PYTHON_VERSION}
32
 
33
  # ---- clone Opentrons repo ----
 
34
  ARG OPENTRONS_REF=edge
35
+ RUN git clone --depth 1 --branch ${OPENTRONS_REF} https://github.com/Opentrons/opentrons.git /root/opentrons
 
 
 
 
36
 
37
  WORKDIR /root/opentrons
38
 
39
+ # ---- robot-server setup ----
 
40
  RUN uv run --python ${PYTHON_VERSION} make -C robot-server setup
41
 
42
+ # ---- app user ----
 
 
 
43
  RUN useradd -m -u 1000 user
44
  USER user
45
+ ENV HOME=/home/user
 
46
 
47
  WORKDIR $HOME/app
48
 
49
  # cache-friendly deps install
50
  COPY --chown=user requirements.txt $HOME/app/requirements.txt
51
+
52
+ # create venv + install deps (user can run uv now)
53
  RUN uv venv --python ${PYTHON_VERSION} .venv \
54
  && uv pip install --python .venv/bin/python -r requirements.txt
55
 
56
+ # copy app
57
  COPY --chown=user . $HOME/app
58
 
59
+ # ---- entrypoint ----
60
  USER root
61
  COPY entrypoint.sh /entrypoint.sh
62
  RUN chmod +x /entrypoint.sh