kohanucha

kohanucha's avatar
kohanucha
npub1d0gj...0hxg
Back-end developer
ขณะที่ผมกำลังกราวดิ้งอยู่นั้น ก็มีเจ้าสิ่งนี้เข้ามาทักทาย #siamstr #แมงแสนตี๋น
#siamstr มีใครเคยใช้ swap out ของ alby hub มั้ยครับ ผมสงสัยว่า ถ้าเกิด Failed to pay swap invoice แล้วมันจะ unlock funds ของเราตอนไหน image
#siamstr วันนี้มาแจกตัวอย่าง Dockerfile สำหรับ build electrs server docker image เผื่อใครสนใจทำไว้ run เล่นเองที่บ้านครับ Dockerfile ``` FROM rust:slim-bookworm AS build # Declare build args ARG VERSION=master # Install build dependencies RUN apt-get update && apt-get install -qqy \ clang cmake build-essential git pkg-config libssl-dev \ librocksdb-dev # Clone and build electrs RUN git clone /electrs && \ cd /electrs && \ git checkout ${VERSION} && \ cargo build --locked --release FROM debian:bookworm-slim AS runtime # Declare runtime args ARG UID= ARG GID= ARG USERNAME= ARG GROUPNAME= # Create group and user RUN groupadd -g ${GID} ${GROUPNAME} && \ useradd -u ${UID} -g ${GID} -m -s /bin/bash ${USERNAME} && \ mkdir -p /home/${USERNAME}/electrs/bin /home/${USERNAME}/electrs/db /home/${USERNAME}/electrs/bitcoin && \ chown -R ${USERNAME}:${GROUPNAME} /home/${USERNAME} # Copy the built binary COPY --from=build /electrs/target/release/electrs /home/${USERNAME}/electrs/bin/ # Switch to non-root user USER ${USERNAME} WORKDIR /home/${USERNAME}/electrs # Expose port 50001 EXPOSE 50001 # Run the binary CMD ["./bin/electrs"] ``` build.sh ``` #!/bin/bash VERSION=v0.10.9 export VERSION=${VERSION} docker buildx build --build-arg VERSION -t electrs:${VERSION} /path/to/dockerfile ```