1
1
ARG BASE_IMAGE="ubuntu:20.04"
2
2
ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
3
- ARG LIBOSI_VERSION="v0.1.7"
4
3
5
4
# ## BASE IMAGE
6
- FROM $BASE_IMAGE as base
5
+ FROM $BASE_IMAGE AS base
7
6
ARG BASE_IMAGE
8
7
9
8
# Copy dependencies lists into container. We copy them all and then do a mv because
@@ -16,22 +15,19 @@ RUN mv /tmp/$(echo "$BASE_IMAGE" | sed 's/:/_/g')_build.txt /tmp/build_dep.txt &
16
15
# Base image just needs runtime dependencies
17
16
RUN [ -e /tmp/base_dep.txt ] && \
18
17
apt-get -qq update && \
19
- DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends curl $(cat /tmp/base_dep.txt | grep -o '^[^#]*' ) && \
18
+ DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends curl jq $(cat /tmp/base_dep.txt | grep -o '^[^#]*' ) && \
20
19
apt-get clean
21
20
22
21
# ## BUILD IMAGE - STAGE 2
23
22
FROM base AS builder
24
23
ARG BASE_IMAGE
25
24
ARG TARGET_LIST
26
- ARG LIBOSI_VERSION
27
25
28
26
RUN [ -e /tmp/build_dep.txt ] && \
29
27
apt-get -qq update && \
30
28
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*' ) && \
31
29
apt-get clean && \
32
30
python3 -m pip install --upgrade --no-cache-dir pip && \
33
- python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
34
- python3 -m pip install --upgrade --no-cache-dir "capstone" && \
35
31
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
36
32
37
33
# Then install capstone from source
@@ -43,13 +39,19 @@ RUN cd /tmp && \
43
39
ENV PATH="/root/.cargo/bin:${PATH}"
44
40
45
41
# install libosi
46
- RUN cd /tmp && curl -LJO https://github.com/panda-re/libosi/releases/download/${LIBOSI_VERSION}/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}' ).deb && dpkg -i /tmp/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}' ).deb
42
+ RUN cd /tmp && \
43
+ BASE_IMAGE_VERSION=$(echo "$BASE_IMAGE" | awk -F':' '{print $2}' ) && \
44
+ LIBOSI_VERSION=$(curl -s https://api.github.com/repos/panda-re/libosi/releases/latest | jq -r .tag_name) && \
45
+ curl -LJO https://github.com/panda-re/libosi/releases/download/${LIBOSI_VERSION}/libosi_${BASE_IMAGE_VERSION}.deb && \
46
+ dpkg -i /tmp/libosi_${BASE_IMAGE_VERSION}.deb && \
47
+ rm -rf /tmp/libosi_${BASE_IMAGE_VERSION}.deb
47
48
48
49
# Build and install panda
49
50
# Copy repo root directory to /panda, note we explicitly copy in .git directory
50
51
# Note .dockerignore file keeps us from copying things we don't need
51
52
COPY . /panda/
52
53
COPY .git /panda/
54
+ RUN python3 -m pip install -r /panda/panda/python/core/requirements.txt
53
55
54
56
# Note we diable NUMA for docker builds because it causes make check to fail in docker
55
57
RUN git -C /panda submodule update --init dtc && \
@@ -64,12 +66,11 @@ RUN git -C /panda submodule update --init dtc && \
64
66
--disable-numa \
65
67
--enable-llvm && \
66
68
rm -rf /panda/.git
67
-
68
69
69
70
RUN PRETEND_VERSION=$(cat /tmp/savedversion) make -C /panda/build -j "$(nproc)"
70
71
71
72
# ### Develop setup: panda built + pypanda installed (in develop mode) - Stage 3
72
- FROM builder as developer
73
+ FROM builder AS developer
73
74
RUN cd /panda/panda/python/core && \
74
75
python3 create_panda_datatypes.py && \
75
76
PRETEND_VERSION=$(cat /tmp/savedversion) pip install -e . && \
@@ -82,33 +83,27 @@ RUN cd /panda/panda/python/core && \
82
83
WORKDIR /panda/
83
84
84
85
# ### Install PANDA + pypanda from builder - Stage 4
85
- FROM builder as installer
86
+ FROM builder AS installer
86
87
RUN make -C /panda/build install && \
87
88
rm -r /usr/local/lib/panda/*/cosi \
88
89
/usr/local/lib/panda/*/cosi_strace \
89
90
/usr/local/lib/panda/*/gdb \
90
91
/usr/local/lib/panda/*/snake_hook \
91
92
/usr/local/lib/panda/*/rust_skeleton
92
93
93
- # Install pypanda
94
+ # Build wheel and install pypanda
94
95
RUN cd /panda/panda/python/core && \
95
96
python3 create_panda_datatypes.py --install && \
97
+ PRETEND_VERSION=$(cat /tmp/savedversion) python3 -m build --wheel . && \
96
98
PRETEND_VERSION=$(cat /tmp/savedversion) pip install .
97
- RUN python3 -m pip install --upgrade pip "setuptools<65.6.0" && \
98
- python3 -m pip install "pycparser<2.22" && \
99
- python3 -m pip install --force-reinstall --no-binary :all: cffi
100
- # Build a whl too
101
- RUN cd /panda/panda/python/core && \
102
- python3 create_panda_datatypes.py --install && \
103
- PRETEND_VERSION=$(cat /tmp/savedversion) python3 -m build --wheel .
104
99
105
100
# BUG: PANDA sometimes fails to generate all the necessary files for PyPANDA. This is a temporary fix to detect and fail when this occurs
106
101
RUN ls -alt $(pip show pandare | grep Location: | awk '{print $2}' )/pandare/autogen/
107
102
RUN bash -c "ls $(pip show pandare | grep Location: | awk '{print $2}')/pandare/autogen/panda_{aarch64_64,arm_32,mips64_64,mips_32,mipsel_32,ppc_32,ppc_64,x86_64_64,i386_32}.py"
108
103
109
104
# this layer is used to strip shared objects and change python data to be
110
105
# symlinks to the installed panda data directory
111
- FROM installer as cleanup
106
+ FROM installer AS cleanup
112
107
RUN find /usr/local/lib/panda -name "*.so" -exec strip {} \;
113
108
RUN PKG=`pip show pandare | grep Location: | awk '{print $2}' `/pandare/data; \
114
109
rm -rf $PKG/pc-bios && ln -s /usr/local/share/panda $PKG/pc-bios; \
@@ -123,24 +118,23 @@ RUN PKG=`pip show pandare | grep Location: | awk '{print $2}'`/pandare/data; \
123
118
done
124
119
125
120
# ## Copy files for panda+pypanda from installer - Stage 5
126
- FROM base as panda
121
+ FROM base AS panda
127
122
128
123
# Include dependency lists for packager
129
124
COPY --from=base /tmp/base_dep.txt /tmp
130
125
COPY --from=base /tmp/build_dep.txt /tmp
131
126
132
127
# Copy panda + libcapstone.so* + libosi libraries
133
128
COPY --from=cleanup /usr/local /usr/local
134
- COPY --from=cleanup /usr/lib/libcapstone* /usr/lib/
135
- COPY --from=cleanup /lib/libosi.so /lib/libiohal.so /lib/liboffset.so /lib/
129
+ COPY --from=cleanup /usr/lib/libcapstone.so * /usr/lib/x86_64-linux-gnu /
130
+ COPY --from=cleanup /usr/ lib/x86_64-linux-gnu/ libosi.so /usr/ lib/x86_64-linux-gnu/ libiohal.so /usr/ lib/x86_64-linux-gnu/ liboffset.so /usr/ lib/x86_64-linux-gnu /
136
131
137
132
# Workaround issue #901 - ensure LD_LIBRARY_PATH contains the panda plugins directories
138
133
# ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu"
139
134
ENV LD_LIBRARY_PATH /usr/local/lib/python3.8/dist-packages/pandare/data/x86_64-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/i386-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/arm-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/ppc-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/mips-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/mipsel-softmmu/panda/plugins/
140
135
# PANDA_PATH is used by rust plugins
141
136
ENV PANDA_PATH /usr/local/lib/python3.8/dist-packages/pandare/data
142
137
143
-
144
138
# Ensure runtime dependencies are installed for our libpanda objects and panda plugins
145
139
RUN ldconfig && \
146
140
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
0 commit comments