Skip to content

Commit

Permalink
Merge pull request #15 from pymumu/master
Browse files Browse the repository at this point in the history
Fork Sync
  • Loading branch information
PikuZheng authored Aug 1, 2022
2 parents 09a0207 + 2f1d83c commit e546702
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
FROM ubuntu:latest as smartdns-builder
LABEL previous-stage=smartdns-builder
COPY . /smartdns/

# prepare builder
ARG OPENSSL_VER=1.1.1f
RUN apt update && \
apt install -y perl wget make musl-tools musl-dev && \
OPENSSL_VER=1.1.1f && \
mkdir /build -p && \
apt install -y perl curl make musl-tools musl-dev && \
ln -s /usr/include/linux /usr/include/$(uname -m)-linux-musl && \
ln -s /usr/include/asm-generic /usr/include/$(uname -m)-linux-musl && \
ln -s /usr/include/$(uname -m)-linux-gnu/asm /usr/include/$(uname -m)-linux-musl && \
cd /build && \
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_${OPENSSL_VER}.orig.tar.gz && \
tar xf openssl_${OPENSSL_VER}.orig.tar.gz && \
cd openssl-${OPENSSL_VER} && \
\
mkdir -p /build/openssl && \
cd /build/openssl && \
curl -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_${OPENSSL_VER}.orig.tar.gz | tar --strip-components=1 -zxv && \
\
export CC=musl-gcc && \
if [ "$(uname -m)" = "aarch64" ]; then \
./config --prefix=/opt/build no-tests -mno-outline-atomics ; \
else \
./config --prefix=/opt/build no-tests; \
./config --prefix=/opt/build no-tests ; \
fi && \
make all -j8 && make install_sw && \
cd /smartdns && \
cd / && rm -rf /build

# do make
COPY . /build/smartdns/
RUN cd /build/smartdns && \
export CC=musl-gcc && \
export CFLAGS="-I /opt/build/include" && \
export LDFLAGS="-L /opt/build/lib" && \
sh ./package/build-pkg.sh --platform linux --arch `dpkg --print-architecture` --static && \
mkdir /release -p && \
cd /smartdns/package && tar xf *.tar.gz && \
cp /smartdns/package/smartdns/etc /release/ -a && \
cp /smartdns/package/smartdns/usr /release/ -a && \
chmod +x /release/etc/init.d/smartdns && \
mkdir /release/var/log/ /release/var/run/ -p && \
rm -fr /build /smartdns
\
( cd package && tar -xvf *.tar.gz && chmod a+x smartdns/etc/init.d/smartdns ) && \
\
mkdir -p /release/var/log /release/var/run && \
cp package/smartdns/etc /release/ -a && \
cp package/smartdns/usr /release/ -a && \
cd / && rm -rf /build

FROM busybox:latest
COPY --from=smartdns-builder /release/ /
Expand Down

0 comments on commit e546702

Please sign in to comment.