Dockerfile56 lines · 2105 chars # Stage 1: build minimal prebuilt artifacts (fake-hwaddr and fake-getlogin)
FROM debian:bookworm-slim AS build
ARG ANDROID_PATCH BUILD_ENV=local MIRROR_URL=http://ftp.cn.debian.org/debian/ EC_HOST http_proxy https_proxy
ENV DEBIAN_FRONTEND=noninteractive
# Install build tools
RUN apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
build-essential ca-certificates wget unzip && \
rm -rf /var/lib/apt/lists/*
# Build helper scripts (present in repo)
COPY ["./build-scripts/config-apt.sh", "./build-scripts/get-echost-names.sh", "./build-scripts/add-qemu.sh", "/tmp/build-scripts/"]
RUN . /tmp/build-scripts/config-apt.sh && \
. /tmp/build-scripts/get-echost-names.sh && \
. /tmp/build-scripts/add-qemu.sh
# Prepare output directories
RUN mkdir -p /results/fake-hwaddr /results/fake-getlogin /tmp/src
# Copy sources and build minimal artifacts
COPY fake-hwaddr /tmp/src/fake-hwaddr/
COPY fake-getlogin /tmp/src/fake-getlogin/
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 && \
cd /tmp/src/fake-getlogin && CC=${ec_cc} make clean all && install -D fake-getlogin.so /results/fake-getlogin/usr/local/lib/fake-getlogin.so
RUN mkdir -p /results/BUILD_LOG && echo 'Packaged artifacts prepared' > /results/BUILD_LOG/BUILD_LOG.txt
# Stage 2: runtime image
FROM debian:bookworm-slim
# Copy artifacts from build stage
COPY --from=build /results/fake-hwaddr/ /results/fake-hwaddr/
COPY --from=build /results/fake-getlogin/ /results/fake-getlogin/
# Also bring in docker-root assets directly where needed
COPY docker-root /
# Ensure runtime entrypoint and helper scripts are in PATH
COPY docker-root/usr/local/bin /usr/local/bin
COPY docker-root/usr/share /usr/share
# Provide explicit start script at root for smoke tests
COPY docker-root/usr/local/bin/start.sh /start.sh
RUN chmod +x /start.sh
ENV PING_INTERVAL=1800
VOLUME /root/ /usr/share/sangfor/EasyConnect/resources/logs/
CMD ["/start.sh"]