diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..50071ee46 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,16 @@ +--- +name: Docker + +on: + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + docker: + runs-on: ubuntu-latest + permissions: {} + steps: + - run: echo "Building and pushing Docker image..." diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..83552048e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM rust:latest AS builder + +ARG STELLAR_CLI_REF=main + +RUN apt-get update && \ + apt-get install -y --no-install-recommends libdbus-1-dev libudev-dev pkg-config git && \ + rm -rf /var/lib/apt/lists/* + +RUN git clone https://github.com/stellar/stellar-cli.git /tmp/stellar-cli && \ + cd /tmp/stellar-cli && \ + git fetch origin "${STELLAR_CLI_REF}" && \ + git checkout "${STELLAR_CLI_REF}" && \ + cargo install --locked --path cmd/stellar-cli && \ + rm -rf /tmp/stellar-cli + +FROM rust:latest + +RUN rustup target add wasm32v1-none + +RUN apt-get update && \ + apt-get install -y --no-install-recommends dbus gnome-keyring libdbus-1-3 libudev1 libssl3 && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /usr/local/cargo/bin/stellar /usr/local/bin/stellar + +ENV STELLAR_CONFIG_HOME=/config +ENV STELLAR_DATA_HOME=/data + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + +WORKDIR /source + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh", "stellar"] +CMD [] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 000000000..832c4786e --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +# Start D-Bus session bus +export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/dbus-session" +dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --fork + +# Unlock gnome-keyring with an empty password for non-interactive use +eval "$(echo '' | gnome-keyring-daemon --unlock --components=secrets)" +export GNOME_KEYRING_CONTROL +export SSH_AUTH_SOCK + +cd /source +exec "$@"