baxin commited on
Commit
51a9c73
·
verified ·
1 Parent(s): a6561fb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -14
Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # ---- base system deps ----
6
  RUN apt-get update \
7
  && apt-get install -y --no-install-recommends \
8
  build-essential \
@@ -10,13 +10,12 @@ RUN apt-get update \
10
  make \
11
  curl \
12
  ca-certificates \
 
13
  libudev-dev \
14
  libsystemd-dev \
15
- pkg-config \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  # ---- install uv ----
19
- # installs to /root/.local/bin/uv
20
  RUN curl -LsSf https://astral.sh/uv/install.sh | sh
21
  ENV PATH=/root/.local/bin:$PATH
22
 
@@ -24,39 +23,43 @@ ENV PATH=/root/.local/bin:$PATH
24
  ARG PYTHON_VERSION=3.12.12
25
  RUN uv python install ${PYTHON_VERSION}
26
 
27
- # ---- opentrons workspace ----
28
- WORKDIR /root/opentrons
 
 
29
 
30
- # copy opentrons repo (robot-server含む)
31
- COPY . /root/opentrons
 
 
 
32
 
33
  # ---- robot-server setup (use uv-managed python) ----
 
34
  RUN uv run --python ${PYTHON_VERSION} make -C robot-server setup
35
 
36
- # ---- create app user ----
 
 
 
37
  RUN useradd -m -u 1000 user
38
  USER user
39
-
40
  ENV HOME=/home/user \
41
  PATH=/home/user/.local/bin:$PATH
42
 
43
  WORKDIR $HOME/app
44
 
45
- # ---- Python deps (cache-friendly) ----
46
  COPY --chown=user requirements.txt $HOME/app/requirements.txt
47
-
48
  RUN uv venv --python ${PYTHON_VERSION} .venv \
49
  && uv pip install --python .venv/bin/python -r requirements.txt
50
 
51
- # ---- copy rest of app ----
52
  COPY --chown=user . $HOME/app
53
 
54
- # ---- entrypoint ----
55
  USER root
56
  COPY entrypoint.sh /entrypoint.sh
57
  RUN chmod +x /entrypoint.sh
58
 
59
  WORKDIR /root/opentrons
60
-
61
  ENTRYPOINT ["/bin/bash", "-lc", "source /entrypoint.sh && exec \"$@\""]
62
  CMD ["bash"]
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # ---- system deps ----
6
  RUN apt-get update \
7
  && apt-get install -y --no-install-recommends \
8
  build-essential \
 
10
  make \
11
  curl \
12
  ca-certificates \
13
+ pkg-config \
14
  libudev-dev \
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
 
 
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=main
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
62
 
63
  WORKDIR /root/opentrons
 
64
  ENTRYPOINT ["/bin/bash", "-lc", "source /entrypoint.sh && exec \"$@\""]
65
  CMD ["bash"]