baxin commited on
Commit
a6561fb
·
verified ·
1 Parent(s): 98ecc08

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -16
Dockerfile CHANGED
@@ -1,58 +1,62 @@
1
- FROM kojikno/ot-robot-server:v1.2
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # ---- system deps ----
6
  RUN apt-get update \
7
  && apt-get install -y --no-install-recommends \
8
- libudev-dev \
9
- libsystemd-dev \
 
10
  curl \
11
  ca-certificates \
 
 
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  # ---- install uv ----
15
- # installs to /root/.local/bin/uv by default
16
  RUN curl -LsSf https://astral.sh/uv/install.sh | sh
17
  ENV PATH=/root/.local/bin:$PATH
18
 
19
- # ---- install Python (replace pyenv) ----
20
- # pin python version you need
21
  ARG PYTHON_VERSION=3.12.12
22
  RUN uv python install ${PYTHON_VERSION}
23
 
24
- # working dir for opentrons repo in base image
25
  WORKDIR /root/opentrons
26
 
27
- # if robot-server setup needs python, make sure it uses uv's python
28
- # (This uses uv's managed interpreter directly)
 
 
29
  RUN uv run --python ${PYTHON_VERSION} make -C robot-server setup
30
 
31
- # ---- app user ----
32
  RUN useradd -m -u 1000 user
33
  USER user
 
34
  ENV HOME=/home/user \
35
  PATH=/home/user/.local/bin:$PATH
36
 
37
  WORKDIR $HOME/app
38
 
39
- # copy only requirements first for docker layer caching
40
  COPY --chown=user requirements.txt $HOME/app/requirements.txt
41
 
42
- # create venv + install deps (in user's home)
43
  RUN uv venv --python ${PYTHON_VERSION} .venv \
44
  && uv pip install --python .venv/bin/python -r requirements.txt
45
 
46
- # now copy the rest
47
  COPY --chown=user . $HOME/app
48
 
49
  # ---- entrypoint ----
50
- # IMPORTANT: ENTRYPOINT cannot "source" directly
51
- # use bash -lc so "source" works and env is loaded
52
  USER root
53
  COPY entrypoint.sh /entrypoint.sh
54
  RUN chmod +x /entrypoint.sh
55
 
56
  WORKDIR /root/opentrons
 
57
  ENTRYPOINT ["/bin/bash", "-lc", "source /entrypoint.sh && exec \"$@\""]
58
  CMD ["bash"]
 
1
+ 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 \
9
+ git \
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
 
23
+ # ---- install Python via uv ----
 
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"]