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

@@ -6,16 +6,16 @@ WORKDIR /build
RUN apk update && \
apk add \
git \
rust
RUN apk add cargo
rust \
cargo
ARG TXOO_GIT_HASH=528fa92e5def1b6cc19127f2242137bf6f13550d
ARG TXOO_REPO=https://gitlab.com/lightning-signer/txoo.git
RUN git clone --recurse-submodules $TXOO_REPO
RUN cd txoo && \
git checkout $TXOO_GIT_HASH && \
cargo build --release -p txood
cargo install --path ./txood --bin txood --profile release --root /usr/local/ && \
cargo clean
# txoo runner
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
@@ -32,7 +32,7 @@ RUN apk update && \
libev-dev \
curl-dev
COPY --from=builder /build/txoo/target/release/txood /usr/bin/txood
COPY --from=builder /usr/local/bin/txood /usr/bin/txood
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh