Browse Source

build: separate to-json compile

dev
Dnomd343 2 years ago
parent
commit
9fafaf1092
  1. 19
      Dockerfile

19
Dockerfile

@ -38,16 +38,21 @@ RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VersionString=${DN
COPY --from=upx /tmp/upx /usr/bin/ COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/dnsproxy RUN upx -9 /tmp/dnsproxy
FROM ${RUST} AS cleardns FROM ${RUST} AS to-json
RUN apk add build-base cmake # TODO: update crates.io index
COPY ./ /ClearDNS/ COPY ./src/to-json/ /to-json/
WORKDIR /ClearDNS/src/to-json/ WORKDIR /to-json/
RUN cargo build --release RUN cargo build --release
WORKDIR /ClearDNS/bin/ WORKDIR ./target/release/
RUN cp libto_json.a /
FROM ${ALPINE} AS cleardns
RUN apk add build-base cmake
COPY ./ /cleardns/
COPY --from=to-json /libto_json.a /cleardns/src/to-json/target/release/
WORKDIR /cleardns/bin/
RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_BUILD_TYPE=Release .. && make RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_BUILD_TYPE=Release .. && make
RUN strip cleardns && mv cleardns /tmp/ RUN strip cleardns && mv cleardns /tmp/
COPY --from=upx /tmp/upx /usr/bin/
RUN upx -9 /tmp/cleardns
FROM ${ALPINE} AS build FROM ${ALPINE} AS build
RUN apk add xz RUN apk add xz

Loading…
Cancel
Save