Skip to content

Commit

Permalink
fix: use debian buster as builder for util binaries in startos
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Jul 11, 2024
1 parent d1909ed commit e702c8c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
39 changes: 17 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Stage 1: Build gatewayd
# Stage 1: Build yq binary
FROM debian:buster AS builder

ARG PLATFORM
ARG ARCH

RUN apt update && apt install -y ca-certificates
RUN sed -i "s|http://|https://|g" /etc/apt/sources.list
RUN apt-get update && apt-get -y upgrade && apt-get install -y -qq --no-install-recommends wget bash

RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${PLATFORM} -O /usr/bin/yq && chmod +x /usr/bin/yq

# Stage 2: Build gatewayd
FROM fedimint/gatewayd:v0.3.1 AS gatewayd

# Copy yq binary from the builder stage
COPY --from=builder /usr/bin/yq /bin/yq

# Set environment variables for gatewayd
ENV FM_GATEWAY_DATA_DIR=/gateway_data
ENV FM_GATEWAY_LISTEN_ADDR=0.0.0.0:8175
Expand All @@ -9,29 +24,9 @@ ENV FM_GATEWAY_PASSWORD=thereisnosecondbest
ENV FM_GATEWAY_FEES=0,10000
ENV FM_LND_RPC_ADDR=https://lnd.embassy:10009
ENV FM_LND_TLS_CERT=/lnd_data/tls.cert
ENV FM_LND_MACAROON=/lnd_data/data/chain/bitcoin/signet/admin.macaroon
ENV FM_LND_MACAROON=/lnd_data/data/chain/bitcoin/mainnet/admin.macaroon

ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod +x /usr/local/bin/docker_entrypoint.sh

ENTRYPOINT ["/usr/local/bin/docker_entrypoint.sh"]

# # Set up volumes for gatewayd
# VOLUME ["/gateway_data"]

# # Stage 2: Build gateway-ui
# FROM fedimintui/gateway-ui:0.3.0 as gateway-ui

# # Set environment variables for gateway-ui
# ENV PORT=3001
# ENV REACT_APP_FM_GATEWAY_API=http://127.0.0.1:8175
# ENV REACT_APP_FM_GATEWAY_PASSWORD=thereisnosecondbest

# # Expose ports for gateway-ui
# EXPOSE 3001

# # Final stage: Combine both
# FROM fedimint/gatewayd:v0.3.0

# # Copy gateway-ui files
# COPY --from=gateway-ui /usr/share/nginx/html /usr/share/nginx/html
14 changes: 13 additions & 1 deletion docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

set -e

export HOST_IP=$(ip -4 route list match 0/0 | awk '{print $3}')
export GATEWAY_CONFIG_PATH=/root

Expand All @@ -21,6 +20,19 @@ if [[ ! -z $result ]]; then
echo "Waiting for LND admin macaroon to be generated..."
sleep 30
done

# Create the directory structure for mainnet
mkdir -p /lnd_data/data/chain/bitcoin/mainnet

# Copy all macaroon files to the mainnet directory
cp /mnt/lnd/*.macaroon /lnd_data/data/chain/bitcoin/mainnet/

# Copy the TLS certificate
cp /mnt/lnd/tls.cert /lnd_data/tls.cert
fi

# Set LND address
export LND_ADDRESS='lnd.embassy'
export LND_IP=$(getent hosts $LND_ADDRESS | awk '{ print $1 }')

exec tini -g -- gatewayd lnd

0 comments on commit e702c8c

Please sign in to comment.