dockerfile: optimize on size and network call

- merge multiple steps to reduce number of layers
- run make clean to reduce layer size
- run cargo clean
- merge multiple ARG into single step
Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
This commit is contained in:
Lakshya Singh
2023-11-23 21:26:59 +05:30
parent 7e5d66f55d
commit eeaac24d54
4 changed files with 49 additions and 45 deletions

View File

@@ -16,7 +16,8 @@ ARG GIT_HASH=af02dac8b855c361d74234387d288a9591fad1d5
RUN git clone https://gitlab.com/lightning-signer/validating-lightning-signer.git vls
RUN cd vls && \
git checkout $GIT_HASH && \
cargo build --bin vlsd2 --release
cargo install --path ./vls-proxy --bin vlsd2 --profile release --root /usr/local/ && \
cargo clean
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
@@ -36,7 +37,7 @@ RUN apk update && \
protobuf \
bind-tools
COPY --from=builder /build/vls/target/release/vlsd2 /usr/local/bin/vlsd2
COPY --from=builder /usr/local/bin/vlsd2 /usr/local/bin/vlsd2
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh