Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
93 lines (76 loc) · 3.15 KB
/
Copy pathDockerfile
File metadata and controls
93 lines (76 loc) · 3.15 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
################################################################################
# Install dependencies for dev #
################################################################################
# https://github.com/moby/moby/issues/38379#issuecomment-448445652
ARG fromImage=ubuntu:24.04
ARG devImage=dev
FROM $fromImage AS dev
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ARG INSTALLER_ARGS=""
COPY etc/DependencyInstaller.sh /tmp/.
RUN <<EOF
set -e
/tmp/DependencyInstaller.sh -ci -base
# The dev image serves both build systems, so it carries the Bazel dependency
# set too: bazelisk plus the libxml2 and X11/xcb runtime libraries the Bazel
# build needs, which on Ubuntu 26.04 include the libxml2.so.2 compatibility
# symlink without which the prebuilt LLVM lld cannot load.
/tmp/DependencyInstaller.sh -bazel
/tmp/DependencyInstaller.sh -ci -common -save-deps-prefixes=/etc/openroad_deps_prefixes.txt $INSTALLER_ARGS
if echo "$fromImage" | grep -q "ubuntu"; then
echo "fromImage contains 'ubuntu' — stripping section from libQt5Core.so"
strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so || true
else
echo "Skipping strip command as fromImage does not contain 'ubuntu'"
fi
if command -v apt-get >/dev/null 2>&1; then
rm -rf /var/lib/apt/lists/*
fi
rm -f /tmp/DependencyInstaller.sh
EOF
################################################################################
# Build OpenROAD from source #
################################################################################
FROM $devImage AS builder
ARG numThreads=NotSet
# Release builds pass the published version, for example
# --build-arg orVersion=2026-09-10. The build context has no .git directory,
# so the Bazel stamp cannot find the version by itself.
ARG orVersion=""
RUN <<EOF
set -e
groupadd user --gid 9000
useradd --create-home --uid 9000 -g user --skel /etc/skel --shell /bin/bash user
EOF
USER user
WORKDIR /OpenROAD
COPY --chown=user:user . .
# Keep Bazel's build cache out of the published builder image.
RUN --mount=type=cache,target=/home/user/.cache,uid=9000,gid=9000 <<EOF
set -e
OPENROAD_VERSION="${orVersion}" \
bash ./etc/Build.sh -prefix=/OpenROAD/install -threads=${numThreads}
test -x /OpenROAD/install/bin/openroad
# Preserve the path used by builder-image consumers.
mkdir -p build/bin
ln -s ../../install/bin/openroad build/bin/openroad
rm -f bazel-OpenROAD bazel-bin bazel-out bazel-testlogs
EOF
COPY --chmod=775 --chown=user:user etc/docker-entrypoint.sh /usr/local/bin/.
################################################################################
# Final Image #
################################################################################
FROM $devImage AS final
COPY --chown=root:root --from=builder /OpenROAD/install/ /usr/
ENV OPENROAD_EXE=/usr/bin/openroad
RUN <<EOF
set -e
groupadd user --gid 9000
useradd --create-home --uid 9000 -g user --skel /etc/skel --shell /bin/bash user
EOF
USER user
WORKDIR /home/user
ENTRYPOINT [ "openroad" ]