-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.blueapi
More file actions
37 lines (29 loc) · 1.4 KB
/
Copy pathDockerfile.blueapi
File metadata and controls
37 lines (29 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Generate a customised version of the stock BlueAPI container image
# The image updates the virtual environment in /app/.venv with the correct versions of
# mx-bluesky dependencies as determined from the uv.lock file
#
# The image does not contain the mx-bluesky or dodal workspaces; these are
# created in the scratch folder at runtime via the blueapi initContainer
# An assumption is made here that at release time the latest blueapi is in effect
FROM ghcr.io/diamondlightsource/blueapi:latest AS base
USER root
ARG DEBIAN_FRONTEND=noninteractive
# Need:
# libgl, libglib2.0 for python cv2 dependency
RUN apt update -y && \
apt upgrade -y && \
apt install -y libgl1 libglib2.0-0
FROM base AS work
# Temporary work folder because uv sync needs to write to this even though
# we don't need it in the build image
COPY --chown=1000:1000 . /work
FROM base AS build
# User 1000 - same as owner of base image .venv files
USER ubuntu
# If running this build locally in podman, and this fails here you may need to run
# chcon -Rt container_file_t .
# in order for podman to bind mount the working directory
RUN --mount=type=bind,from=work,source=/work,target=/tmp/work,rw --mount=type=tmpfs,target=/tmp/uvcache \
cd /tmp/work && \
UV_PYTHON=/app/.venv/bin/python UV_COMPILE_BYTECODE=0 UV_LINK_MODE=copy UV_PROJECT_ENVIRONMENT=/app/.venv uv sync --cache-dir=/tmp/uvcache --locked && \
chmod -R 777 /app/.venv