Merge branch 'touchup' into 'main'

improvements: dockerfile and ci

Closes #10, #9, #7, #6, and #5

See merge request lightning-signer/vls-container!12
This commit is contained in:
dev random 2023-12-06 08:51:22 +00:00
commit 05bde9e6f9
15 changed files with 238 additions and 120 deletions

9
.dockerignore Normal file
View File

@ -0,0 +1,9 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/docker-compose*
**/Dockerfile*
**/*.Dockerfile
LICENSE
README.md

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

57
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,57 @@
stages:
- build
- test
default:
image: docker:24.0.7
services:
- docker:24.0.7-dind
before_script:
- docker version
- docker compose version
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
variables:
VLS_CONTAINER_REGISTRY: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
CACHE: $CI_REGISTRY_IMAGE/cache
CACHE_TAG: $CI_COMMIT_REF_SLUG
IMAGE_TAG: $CI_COMMIT_SHA
build_bitcoin:
tags: [ saas-linux-large-amd64 ]
stage: build
script:
- ./scripts/build_image_cache.sh bitcoind
build_core_lightning:
tags: [ saas-linux-large-amd64 ]
stage: build
script:
- ./scripts/build_image_cache.sh lightningd
build_txoo:
tags: [ saas-linux-medium-amd64 ]
stage: build
script:
- ./scripts/build_image_cache.sh txood
build_vls:
tags: [ saas-linux-large-amd64 ]
stage: build
script:
- ./scripts/build_image_cache.sh vlsd
compose:
tags: [ saas-linux-medium-amd64 ]
stage: test
variables:
BUILDER: compose_builder
before_script:
- docker volume create bitcoin_data
- docker volume create lightning_data
- docker volume create txoo_data
- docker volume create vls_data
- docker buildx create --name=$BUILDER --use
script:
- echo "IMAGE_TAG=${IMAGE_TAG}" > .env
- ./scripts/build_from_cache.sh bitcoind
- ./scripts/build_from_cache.sh lightningd
- ./scripts/build_from_cache.sh txood
- ./scripts/build_from_cache.sh vlsd
- docker compose --profile vls up -d --wait --wait-timeout 120 --build

View File

@ -187,7 +187,7 @@ docker container exec lightningd-test lightning-cli --testnet summary
- [x] standalone docker image for `lightningd` - [x] standalone docker image for `lightningd`
- [x] standalone docker image for `bitcoind` - [x] standalone docker image for `bitcoind`
- [ ] supporting signet - [ ] supporting signet
- [ ] Profile configuration to run `vls` - [x] Profile configuration to run `vls`
- [ ] Healthcheck for `txoo` - [ ] Healthcheck for `txoo`
- [ ] Healthcheck for `vls` - [ ] Healthcheck for `vls`
- [ ] Lightning Storage Server Dockerfile and Compose Service - [ ] Lightning Storage Server Dockerfile and Compose Service

View File

@ -53,21 +53,21 @@ ARG BITCOIN_VERSION=23.0
ARG BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} ARG BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
ARG SHA256SUMS_HASH=aaff81ea001f499e8f6f3221387d7db960d71a3b7a4a2b1aaf2c8060bc94a391 ARG SHA256SUMS_HASH=aaff81ea001f499e8f6f3221387d7db960d71a3b7a4a2b1aaf2c8060bc94a391
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS && \
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc && \
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz && \
RUN gpg --batch --verify SHA256SUMS.asc SHA256SUMS gpg --batch --verify SHA256SUMS.asc SHA256SUMS && \
RUN echo "${SHA256SUMS_HASH} SHA256SUMS" | sha256sum -c - echo "${SHA256SUMS_HASH} SHA256SUMS" | sha256sum -c - && \
RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c - grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c - && \
RUN tar -xzf *.tar.gz tar -xzf *.tar.gz
WORKDIR /bitcoin-${BITCOIN_VERSION} WORKDIR /bitcoin-${BITCOIN_VERSION}
RUN sed -i '/AC_PREREQ/a\AR_FLAGS=cr' src/univalue/configure.ac RUN sed -i '/AC_PREREQ/a\AR_FLAGS=cr' src/univalue/configure.ac && \
RUN sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac && \
RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat.h sed -i s:sys/fcntl.h:fcntl.h: src/compat.h && \
RUN ./autogen.sh ./autogen.sh && \
RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \
--prefix=${BITCOIN_PREFIX} \ --prefix=${BITCOIN_PREFIX} \
--mandir=/usr/share/man \ --mandir=/usr/share/man \
--disable-tests \ --disable-tests \
@ -78,13 +78,15 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
--with-libs \ --with-libs \
--with-sqlite=yes \ --with-sqlite=yes \
--with-daemon --with-daemon
RUN make -j $(nproc)
RUN make install RUN make -j $(nproc) && \
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli make install && \
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx strip ${BITCOIN_PREFIX}/bin/bitcoin-cli \
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind ${BITCOIN_PREFIX}/bin/bitcoin-tx \
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a ${BITCOIN_PREFIX}/bin/bitcoind \
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0 ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a \
${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0 && \
make clean
# Runtime binaries and setup stage # Runtime binaries and setup stage
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
@ -95,8 +97,8 @@ ARG GID=101
LABEL maintainer.0="Lakshya Singh (@king-11)" \ LABEL maintainer.0="Lakshya Singh (@king-11)" \
maintainer.1="Dev Random (@devrandom01)" maintainer.1="Dev Random (@devrandom01)"
RUN addgroup bitcoin --gid ${GID} --system RUN addgroup bitcoin --gid ${GID} --system && \
RUN adduser --uid ${UID} --system bitcoin --ingroup bitcoin adduser --uid ${UID} --system bitcoin --ingroup bitcoin
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add \ RUN apk --no-cache add \
boost-filesystem \ boost-filesystem \
@ -133,7 +135,7 @@ ENTRYPOINT ["/entrypoint.sh"]
RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}" RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}"
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s \ HEALTHCHECK --interval=10s --timeout=20s --start-period=30s \
CMD ["/bin/sh", "-c", "/healthcheck.sh"] CMD ["/bin/sh", "-c", "/healthcheck.sh"]
CMD ["bitcoind"] CMD ["bitcoind"]

View File

@ -19,7 +19,6 @@ services:
ports: ports:
- 19846:19846 - 19846:19846
environment: environment:
- BITCOIN_CHAIN=regtest
- VLS_NETWORK=regtest - VLS_NETWORK=regtest
- BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:38332 - BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:38332

View File

@ -3,14 +3,14 @@ services:
bitcoin-core: bitcoin-core:
build: build:
context: ./bitcoind context: ./bitcoind
image: bitcoind image: bitcoind:${IMAGE_TAG:-latest}
container_name: bitcoind-test container_name: bitcoind-test
volumes: volumes:
- bitcoin_data:/home/bitcoin/.bitcoin - bitcoin_data:/home/bitcoin/.bitcoin
expose: expose:
- 18332 - 18332
networks: networks:
LN_testing: lightning:
aliases: aliases:
- bitcoind - bitcoind
environment: environment:
@ -19,7 +19,7 @@ services:
core-lightning: core-lightning:
build: build:
context: ./lightningd context: ./lightningd
image: lightningd image: lightningd:${IMAGE_TAG:-latest}
container_name: lightningd-test container_name: lightningd-test
command: command:
- --conf=/home/lightning/.lightning/testnet-config - --conf=/home/lightning/.lightning/testnet-config
@ -30,12 +30,11 @@ services:
- 19735 - 19735
- 7701 - 7701
networks: networks:
- LN_testing - lightning
depends_on: depends_on:
bitcoin-core: bitcoin-core:
condition: service_healthy condition: service_healthy
environment: environment:
- BITCOIN_CHAIN=test
- BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332 - BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332
- RUST_LOG=info - RUST_LOG=info
- VLS_NETWORK=testnet - VLS_NETWORK=testnet
@ -45,13 +44,13 @@ services:
txoo: txoo:
build: build:
context: ./txood context: ./txood
image: txood image: txood:${IMAGE_TAG:-latest}
container_name: txood-test container_name: txood-test
restart: unless-stopped restart: unless-stopped
command: command:
- -r http://rpcuser:VLSsigner1@bitcoind:18332 - -r http://rpcuser:VLSsigner1@bitcoind:18332
networks: networks:
- LN_testing - lightning
volumes: volumes:
- txoo_data:/root/.txoo/ - txoo_data:/root/.txoo/
- bitcoin_data:/root/.bitcoin/ - bitcoin_data:/root/.bitcoin/
@ -64,7 +63,7 @@ services:
vls: vls:
build: build:
context: ./vlsd context: ./vlsd
image: vlsd image: vlsd:${IMAGE_TAG:-latest}
container_name: vlsd-test container_name: vlsd-test
profiles: profiles:
- vls - vls
@ -72,7 +71,7 @@ services:
- --log-level=info - --log-level=info
- --connect=http://core-lightning:7701 - --connect=http://core-lightning:7701
networks: networks:
- LN_testing - lightning
volumes: volumes:
- vls_data:/home/vls/.lightning-signer - vls_data:/home/vls/.lightning-signer
environment: environment:
@ -96,4 +95,4 @@ volumes:
external: true external: true
networks: networks:
LN_testing: lightning:

View File

@ -1,4 +1,4 @@
# build stage for core lightning and clboss # build stage for core lightning and its plugins
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as builder FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as builder
ARG TARGETPLATFORM ARG TARGETPLATFORM
@ -27,53 +27,71 @@ RUN apk update && \
zlib-dev \ zlib-dev \
zlib-static zlib-static
ARG CORE_LIGHTNING_GIT_HASH=bd9494c65be09e6f8ecb3bc49b50a859467a65fe ARG CORE_LIGHTNING_GIT_HASH=bd9494c65be09e6f8ecb3bc49b50a859467a65fe \
ARG CORE_LIGHTNING_REPO=https://github.com/lightning-signer/c-lightning.git CORE_LIGHTNING_REPO=https://github.com/lightning-signer/c-lightning.git
RUN git clone --recursive $CORE_LIGHTNING_REPO /repo && \ RUN git clone --recursive $CORE_LIGHTNING_REPO core-lightning
cd /repo && \ RUN cd core-lightning && \
git checkout $CORE_LIGHTNING_GIT_HASH && \ git checkout $CORE_LIGHTNING_GIT_HASH && \
./configure --enable-static --prefix=/usr && \ ./configure --enable-static --prefix=/usr && \
make -j $(nproc) && \ make -j $(nproc) && \
make install make -j $(nproc) install && \
make clean
RUN apk add \ ARG PLUGINS_GIT_HASH=ce078bb74e10b5dea779fcd9fbe77e1d3e72db7a \
autoconf-archive \ PLUGINS_REPO=https://github.com/lightningd/plugins.git
bind-tools \ RUN git clone $PLUGINS_REPO
build-base \ RUN cd plugins && \
curl-dev \ git checkout $PLUGINS_GIT_HASH
libev-dev \
pkgconf \
sqlite-dev
ARG CLBOSS_GIT_HASH=9c050d61f01ffff4b7b5d295f708569dd71b55d3 FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as clboss_builder
ARG CLBOSS_REPO=https://github.com/ZmnSCPxj/clboss.git
RUN git clone --recurse-submodules $CLBOSS_REPO /clboss && \ WORKDIR /build
cd /clboss && \
RUN apk update && \
apk add \
git \
autoconf-archive \
automake \
bind-tools \
build-base \
curl-dev \
libev-dev \
libtool \
pkgconf \
sqlite-dev
ARG CLBOSS_GIT_HASH=9c050d61f01ffff4b7b5d295f708569dd71b55d3 \
CLBOSS_REPO=https://github.com/ZmnSCPxj/clboss.git
RUN git clone --recurse-submodules $CLBOSS_REPO clboss
RUN cd clboss && \
git checkout $CLBOSS_GIT_HASH && \ git checkout $CLBOSS_GIT_HASH && \
autoreconf -i && \ autoreconf -i && \
./configure --prefix=/usr && \ ./configure --prefix=/usr && \
make -j $(nproc) && \ make -j $(nproc) && \
make install make -j $(nproc) install && \
make clean
ARG PLUGINS_GIT_HASH=ce078bb74e10b5dea779fcd9fbe77e1d3e72db7a FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as vls_builder
ARG PLUGINS_REPO=https://github.com/lightningd/plugins.git
RUN git clone $PLUGINS_REPO && \
cd plugins && \
git checkout $PLUGINS_GIT_HASH
RUN apk add \ WORKDIR /build
cargo \
rust \
grpc \
protobuf \
protobuf-dev
ARG VLS_GIT_HASH=af02dac8b855c361d74234387d288a9591fad1d5 RUN apk update && \
ARG VLS_REPO=https://gitlab.com/lightning-signer/validating-lightning-signer.git apk add \
RUN git clone $VLS_REPO && \ build-base \
cd validating-lightning-signer && \ cargo \
git \
grpc \
protobuf \
protobuf-dev \
rust
ARG VLS_GIT_HASH=59544fd5b15658643acebdaf18886022db3d1071 \
VLS_REPO=https://gitlab.com/lightning-signer/validating-lightning-signer.git
RUN git clone $VLS_REPO vls
RUN cd vls && \
git checkout $VLS_GIT_HASH && \ git checkout $VLS_GIT_HASH && \
cargo build --bins -r cargo install --path ./vls-proxy --bin remote_hsmd_socket --profile release --root /usr/local/ && \
cargo clean
# final stage with runtime dependencies and pkgs # final stage with runtime dependencies and pkgs
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
@ -94,8 +112,8 @@ RUN apk update && \
curl-dev \ curl-dev \
sqlite-dev sqlite-dev
ARG LIGHTNINGD_UID=101 ARG LIGHTNINGD_UID=101 \
ARG LIGHTNINGD_USER=lightning LIGHTNINGD_USER=lightning
ARG LIGHTNINGD_HOME=/home/${LIGHTNINGD_USER} ARG LIGHTNINGD_HOME=/home/${LIGHTNINGD_USER}
ENV LIGHTNINGD_DATA=${LIGHTNINGD_HOME}/.lightning \ ENV LIGHTNINGD_DATA=${LIGHTNINGD_HOME}/.lightning \
LIGHTNINGD_RPC_PORT=9835 \ LIGHTNINGD_RPC_PORT=9835 \
@ -104,21 +122,19 @@ ENV LIGHTNINGD_DATA=${LIGHTNINGD_HOME}/.lightning \
RUN mkdir -p /usr/local/src/plugins RUN mkdir -p /usr/local/src/plugins
COPY --from=builder /usr/bin/lightningd /usr/bin/ COPY --from=builder /usr/bin/lightningd /usr/bin/lightning-cli /usr/bin/lightning-hsmtool /usr/bin/
COPY --from=builder /usr/bin/lightning-cli /usr/bin/
COPY --from=builder /usr/bin/lightning-hsmtool /usr/bin/
COPY --from=builder /usr/libexec/c-lightning /usr/libexec/c-lightning COPY --from=builder /usr/libexec/c-lightning /usr/libexec/c-lightning
COPY --from=builder /usr/share/man/man8 /usr/share/man/man8 COPY --from=builder /usr/share/man/man8 /usr/share/man/man8
COPY --from=builder /usr/share/doc/c-lightning /usr/share/doc/c-lightning COPY --from=builder /usr/share/doc/c-lightning /usr/share/doc/c-lightning
COPY --from=builder /usr/bin/clboss /usr/bin/clboss COPY --from=clboss_builder /usr/bin/clboss /usr/bin/clboss
COPY --from=builder /build/plugins/summary /usr/local/src/plugins/summary COPY --from=builder /build/plugins/summary /usr/local/src/plugins/summary
COPY --from=builder /build/validating-lightning-signer/target/release/remote_hsmd_socket /usr/libexec/c-lightning/remote_hsmd_socket COPY --from=vls_builder /usr/local/bin/remote_hsmd_socket /usr/libexec/c-lightning/remote_hsmd_socket
RUN addgroup -S lightning && adduser -S lightning -G lightning && \ RUN addgroup -S lightning && adduser -S lightning -G lightning && \
mkdir -p ${LIGHTNINGD_DATA} && \ mkdir -p ${LIGHTNINGD_DATA} && \
chown -R lightning:lightning ${LIGHTNINGD_DATA} chown -R lightning:lightning ${LIGHTNINGD_DATA}
COPY bitcoin.conf "${BITCOIND_HOME}"/bitcoin.conf COPY bitcoin.conf ${BITCOIND_HOME}/bitcoin.conf
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
@ -128,10 +144,10 @@ RUN chmod +x /healthcheck.sh
VOLUME ["${LIGHTNINGD_DATA}"] VOLUME ["${LIGHTNINGD_DATA}"]
RUN mkdir -p "${BITCOIND_HOME}" && \ RUN mkdir -p ${BITCOIND_HOME} && \
chown -R lightning:lightning "${BITCOIND_HOME}" chown -R lightning:lightning ${BITCOIND_HOME}
COPY bitcoin.conf "${BITCOIND_HOME}"/bitcoin.conf COPY bitcoin.conf ${BITCOIND_HOME}/bitcoin.conf
COPY testnet-config /testnet-config COPY testnet-config /testnet-config
COPY regtest-config /regtest-config COPY regtest-config /regtest-config
@ -142,7 +158,7 @@ RUN pip3 install \
requests \ requests \
packaging packaging
HEALTHCHECK --interval=10s --timeout=10s --start-period=15s \ HEALTHCHECK --interval=5s --timeout=10s --start-period=5s \
CMD ["/bin/sh", "-c", "/healthcheck.sh"] CMD ["/bin/sh", "-c", "/healthcheck.sh"]
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1 +0,0 @@
../bitcoind/bitcoin.conf

23
lightningd/bitcoin.conf Normal file
View File

@ -0,0 +1,23 @@
##
## bitcoin.conf configuration file. Lines beginning with # are comments.
##
server=1
rpcallowip=0.0.0.0/0
whitelist=0.0.0.0/0
txindex=1
blockfilterindex=1
[test]
rpcbind=0.0.0.0
rpcuser=rpcuser
rpcpassword=VLSsigner1
rpcport=18332
port=18333
[regtest]
rpcbind=0.0.0.0
rpcuser=rpcuser
rpcpassword=VLSsigner1
rpcport=38332
port=38333

View File

@ -2,13 +2,4 @@
set -ex set -ex
LIGHTNING_NETWORK="" lightning-cli --network $VLS_NETWORK summary
case $BITCOIN_CHAIN in
"test") LIGHTNING_NETWORK=testnet ;;
"regtest") LIGHTNING_NETWORK=regtest ;;
"signet") LIGHTNING_NETWORK=signet ;;
*) echo "Invalid BITCOIN_CHAIN value: $BITCOIN_CHAIN" && exit 1 ;;
esac
lightning-cli --network $LIGHTNING_NETWORK getinfo

8
scripts/build_from_cache.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
set -ex
SERVICE=$1
cd $SERVICE
docker build --load --builder $BUILDER --cache-from $CACHE/$SERVICE:$CACHE_TAG -t $SERVICE:$IMAGE_TAG .

10
scripts/build_image_cache.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -ex
SERVICE=$1
docker buildx create --name=$SERVICE --use
cd $SERVICE
docker build --load --builder=$SERVICE --cache-to type=registry,ref=$CACHE/$SERVICE:$CACHE_TAG --cache-from $CACHE/$SERVICE:$CACHE_TAG -t $SERVICE:$IMAGE_TAG .

3
scripts/pre-commit Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/sh
cmp bitcoind/bitcoin.conf lightningd/bitcoin.conf

View File

@ -6,16 +6,16 @@ WORKDIR /build
RUN apk update && \ RUN apk update && \
apk add \ apk add \
git \ git \
rust rust \
cargo
RUN apk add cargo ARG TXOO_GIT_HASH=1cfeecf5f806a04a12c97ca17c39566a1a24e732
ARG TXOO_GIT_HASH=528fa92e5def1b6cc19127f2242137bf6f13550d
ARG TXOO_REPO=https://gitlab.com/lightning-signer/txoo.git ARG TXOO_REPO=https://gitlab.com/lightning-signer/txoo.git
RUN git clone --recurse-submodules $TXOO_REPO && \ RUN git clone --recurse-submodules $TXOO_REPO
cd txoo && \ RUN cd txoo && \
git checkout $TXOO_GIT_HASH && \ 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 # txoo runner
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
@ -23,6 +23,8 @@ FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as
LABEL maintainer.0="Lakshya Singh (@king-11)" \ LABEL maintainer.0="Lakshya Singh (@king-11)" \
maintainer.1="Dev Random (@devrandom01)" maintainer.1="Dev Random (@devrandom01)"
ARG TXOO_DATA=/root/.txoo
RUN apk update && \ RUN apk update && \
apk add \ apk add \
build-base \ build-base \
@ -30,12 +32,12 @@ RUN apk update && \
libev-dev \ libev-dev \
curl-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 COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
VOLUME ["/root/.txoo/"] VOLUME ["${TXOO_DATA}"]
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["txood"] CMD ["txood"]

View File

@ -3,22 +3,21 @@ FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as
WORKDIR /build WORKDIR /build
RUN apk update && \ RUN apk update && \
apk add \ apk add \
build-base \ build-base \
cargo \ cargo \
git \ git \
grpc \ grpc \
protobuf \ protobuf \
protobuf-dev \ protobuf-dev \
rust rust
ARG GIT_HASH=af02dac8b855c361d74234387d288a9591fad1d5 ARG GIT_HASH=59544fd5b15658643acebdaf18886022db3d1071
RUN git clone https://gitlab.com/lightning-signer/validating-lightning-signer.git && \ RUN git clone https://gitlab.com/lightning-signer/validating-lightning-signer.git vls
cd validating-lightning-signer && \ RUN cd vls && \
git checkout $GIT_HASH git checkout $GIT_HASH && \
cargo install --path ./vls-proxy --bin vlsd2 --profile release --root /usr/local/ && \
RUN cd validating-lightning-signer && \ cargo clean
cargo build --bins --release
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner
@ -38,7 +37,7 @@ RUN apk update && \
protobuf \ protobuf \
bind-tools bind-tools
COPY --from=builder /build/validating-lightning-signer/target/release/vlsd2 /usr/local/bin/vlsd2 COPY --from=builder /usr/local/bin/vlsd2 /usr/local/bin/vlsd2
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
@ -46,11 +45,11 @@ RUN chmod +x /entrypoint.sh
COPY vlsd2.toml /vlsd2.toml COPY vlsd2.toml /vlsd2.toml
ENV VLS_DATA=/home/vls/.lightning-signer ENV VLS_DATA=/home/vls/.lightning-signer
RUN mkdir "${VLS_DATA}" RUN mkdir ${VLS_DATA}
RUN chown vls:vls "${VLS_DATA}" RUN chown vls:vls ${VLS_DATA}
ENV REMOTE_SIGNER_ALLOWLIST=${VLS_DATA}/ALLOWLIST ENV REMOTE_SIGNER_ALLOWLIST=${VLS_DATA}/ALLOWLIST
RUN touch "${REMOTE_SIGNER_ALLOWLIST}" RUN touch ${REMOTE_SIGNER_ALLOWLIST}
VOLUME ["${VLS_DATA}"] VOLUME ["${VLS_DATA}"]