Browse Source

build: update upx compile

dev
Dnomd343 2 years ago
parent
commit
4b6ae503a4
  1. 22
      Dockerfile

22
Dockerfile

@ -1,19 +1,14 @@
ARG ALPINE="alpine:3.16" ARG ALPINE="alpine:3.16"
ARG GOLANG="golang:1.18-alpine3.16" ARG GOLANG="golang:1.18-alpine3.16"
FROM ${ALPINE} AS apk
WORKDIR /apk/
RUN echo -e "cd \`dirname \$0\`\napk add --no-network \\" > setup && chmod +x setup && apk update && \
apk fetch -R build-base cmake | grep -oE '\S+$' | awk '{print "./"$0".apk \\"}' >> setup && /apk/setup
FROM ${ALPINE} AS upx FROM ${ALPINE} AS upx
COPY --from=apk /apk/ /apk/ RUN apk add build-base cmake git
RUN apk add git && /apk/setup RUN git clone https://github.com/dnomd343/upx.git --depth=1
RUN git clone https://github.com/dnomd343/upx.git
WORKDIR ./upx/ WORKDIR ./upx/
RUN git submodule update --init && rm -rf ./.git/ RUN git submodule update --init && rm -rf ./.git/
RUN make UPX_CMAKE_CONFIG_FLAGS=-DCMAKE_EXE_LINKER_FLAGS=-static && \ RUN make UPX_CMAKE_CONFIG_FLAGS=-DCMAKE_EXE_LINKER_FLAGS=-static
mv ./build/release/upx /tmp/ && strip /tmp/upx WORKDIR ./build/release/
RUN strip upx && mv upx /tmp/
FROM ${GOLANG} AS adguard FROM ${GOLANG} AS adguard
ENV ADGUARD="v0.107.16" ENV ADGUARD="v0.107.16"
@ -49,12 +44,11 @@ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/toJSON RUN upx -9 /tmp/toJSON
FROM ${ALPINE} AS cleardns FROM ${ALPINE} AS cleardns
COPY --from=apk /apk/ /apk/ RUN apk add build-base cmake
RUN /apk/setup
COPY ./ /ClearDNS/ COPY ./ /ClearDNS/
WORKDIR /ClearDNS/bin/ WORKDIR /ClearDNS/bin/
RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_BUILD_TYPE=Release .. && \ RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_BUILD_TYPE=Release .. && make
make && strip cleardns && mv cleardns /tmp/ RUN strip cleardns && mv cleardns /tmp/
FROM ${ALPINE} AS build FROM ${ALPINE} AS build
RUN apk add xz RUN apk add xz

Loading…
Cancel
Save