Files
docker-easyconnect/Dockerfile.build
Hagb f533949090 Support non-amd64 deb package of EasyConnect
Since non-amd64 deb packages of EasyConnect are proved to exist
(https://github.com/Hagb/docker-easyconnect/issues/25#issuecomment-1233369467),
the deb package should not be assume to be amd64 and architecture
specific code should be rewritten:

- Add EC_HOST build argument to tell Dockerfile the architecture of
  EasyConnect package
- Whether to install cross toolchain and qemu-user and which package
  should be install, is determined by EC_HOST and the local architecture
  now, more specifically by build-scripts/get-echost-names.sh (no longer
  hard-code amd64 cross toolchain)
- fake-hwaddr.so should follow the architecture of the EC deb, so
  fake-hwaddr/Makefile uses CC envirnoment variable instead of
  hard-coded x86_64-linux-gnu-gcc as c compiler now
- qemu_args is removed now. It was used to pass LD_PRELOAD to foreign
  binaries under qemu-user, but now we pass LD_PRELOAD to the qemu
  wrapper and wrapper will pass the LD_PRELOAD to the simulated
  binaries
2022-09-24 08:52:32 +08:00

51 lines
2.8 KiB
Docker

FROM debian:bookworm-slim AS build
ARG ANDROID_PATCH BUILD_ENV=local MIRROR_URL=http://ftp.cn.debian.org/debian/ EC_HOST
COPY ["./build-scripts/config-apt.sh", "./build-scripts/get-echost-names.sh", "/tmp/build-scripts/"]
RUN . /tmp/build-scripts/config-apt.sh && \
. /tmp/build-scripts/get-echost-names.sh && \
case "$(dpkg --print-architecture)" in \
amd64 | i386 | arm64 ) go=golang-go ;; \
* ) go=gccgo-go ;; \
esac && \
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests ca-certificates \
busybox libssl-dev automake $go $ecgccpkg build-essential
RUN mkdir results && cd results && mkdir fake-hwaddr tinyproxy-ws novnc
COPY fake-hwaddr /tmp/src/fake-hwaddr/
RUN . /tmp/build-scripts/get-echost-names.sh && \
cd /tmp/src/fake-hwaddr && CC=${ec_cc} make clean all && install -D fake-hwaddr.so /results/fake-hwaddr/usr/local/lib/fake-hwaddr.so
# https://github.com/tinyproxy/tinyproxy/pull/211#issue-382736027
ARG TINYPROXY_COMMIT=991e47d8ebd4b12710828b2b486535e4c25ba26c
RUN cd /tmp/src/ && \
busybox wget https://github.com/tinyproxy/tinyproxy/archive/${TINYPROXY_COMMIT}.zip -O tinyproxy.zip && \
busybox unzip tinyproxy.zip && mv tinyproxy-${TINYPROXY_COMMIT} tinyproxy && cd tinyproxy && \
./autogen.sh --prefix=/usr && make && install -D src/tinyproxy /results/tinyproxy-ws/usr/bin/tinyproxy
ARG NOVNC_METHOD=min-size GOPROXY=http://proxy.golang.com.cn,direct
RUN cd /tmp/src/ && \
case "${NOVNC_METHOD}" in \
min-size ) \
busybox wget https://github.com/novnc/noVNC/archive/refs/heads/master.zip -O novnc.zip && \
busybox wget https://github.com/novnc/websockify-other/archive/refs/heads/master.zip -O novnc-websockify.zip && \
busybox unzip novnc.zip && mv noVNC-master novnc && ln -s vnc.html novnc/index.html && \
sed -i "s#UI.initSetting('path', 'websockify')#UI.initSetting('path','websockify/websockify')#" novnc/app/ui.js && \
mkdir -p /results/novnc/usr/local/share/ && mv novnc /results/novnc/usr/local/share/novnc && \
busybox unzip novnc-websockify.zip && mv websockify-other-master novnc-websockify && \
cd novnc-websockify/c/ && make && install -D websockify /results/novnc/usr/local/bin/websockify ;; \
easy-novnc ) \
busybox wget https://github.com/pgaskin/easy-novnc/archive/refs/heads/master.zip -O easy-novnc.zip && \
busybox unzip easy-novnc.zip && mv easy-novnc-master easy-novnc && cd easy-novnc && \
go build -ldflags "-s -w" -gccgoflags "-Wl,-s,-gc-sections -fdata-sections -ffunction-sections -static-libgo" && \
install -D easy-novnc /results/novnc/usr/local/bin/easy-novnc ;; \
* ) printf "Not a vaild value of NOVNC_METHOD: %s\n" "${NOVNC_METHOD}" >&2 && false ;; \
esac && ln -s novnc-${NOVNC_METHOD}.sh /results/novnc/usr/local/bin/novnc