Skip to content

Commit

Permalink
cleanup custom docker files, 27rc1 bitcoin
Browse files Browse the repository at this point in the history
  • Loading branch information
rsafier committed Mar 24, 2024
1 parent 844af37 commit bf0ae31
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 14 deletions.
33 changes: 33 additions & 0 deletions Docker/bitcoin/27.0rc1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM debian:stable-slim

ARG BITCOIN_VERSION=27.0rc1
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH

RUN apt-get update -y \
&& apt-get install -y curl gosu \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN SYS_ARCH="$(uname -m)" \
&& curl -SLO https://bitcoincore.org/bin/bitcoin-core-27.0/test.rc1/bitcoin-${BITCOIN_VERSION}-${SYS_ARCH}-linux-gnu.tar.gz \
&& tar -xzf *.tar.gz -C /opt \
&& rm *.tar.gz

RUN curl -SLO https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/bitcoin-cli.bash-completion \
&& mkdir /etc/bash_completion.d \
&& mv bitcoin-cli.bash-completion /etc/bash_completion.d/ \
&& curl -SLO https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion \
&& mv bash_completion /usr/share/bash-completion/

COPY docker-entrypoint.sh /entrypoint.sh
COPY bashrc /home/bitcoin/.bashrc

RUN chmod a+x /entrypoint.sh

VOLUME ["/home/bitcoin/.bitcoin"]

EXPOSE 18443 18444 28334 28335

ENTRYPOINT ["/entrypoint.sh"]

CMD ["bitcoind"]
File renamed without changes.
29 changes: 29 additions & 0 deletions Docker/bitcoin/27.0rc1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
set -e

# containers on linux share file permissions with hosts.
# assigning the same uid/gid from the host user
# ensures that the files can be read/write from both sides
if ! id bitcoin > /dev/null 2>&1; then
USERID=${USERID:-1000}
GROUPID=${GROUPID:-1000}

echo "adding user bitcoin ($USERID:$GROUPID)"
groupadd -f -g $GROUPID bitcoin
useradd -r -u $USERID -g $GROUPID bitcoin
chown -R $USERID:$GROUPID /home/bitcoin
fi

if [ $(echo "$1" | cut -c1) = "-" ]; then
echo "$0: assuming arguments for bitcoind"

set -- bitcoind "$@"
fi

if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then
echo "Running as bitcoin user: $@"
exec gosu bitcoin "$@"
fi

echo "$@"
exec "$@"
File renamed without changes.
8 changes: 8 additions & 0 deletions Docker/lnd/bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
File renamed without changes.
5 changes: 3 additions & 2 deletions LNUnit.Tests/ABCLightningScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ public async Task OneTimeSetUp()
// f.Database.Migrate();

var tag = "polar_lnd_0_16_3:latest";
await _client.CreateDockerImageFromPath("./../../../../Docker/", new List<string> { tag });
await _client.CreateDockerImageFromPath("./../../../../Docker/lnd", new List<string> { tag });
await _client.CreateDockerImageFromPath("./../../../../Docker/bitcoin/27.0rc1", new List<string> { "bitcoin:27.0rc1" });
await _client.Networks.PruneNetworksAsync(new NetworksDeleteUnusedParameters());
await RemoveContainer("miner");
await RemoveContainer("alice");
Expand All @@ -164,7 +165,7 @@ public async Task OneTimeSetUp()
// _LNUnitBuilder.Configuration.DockerNetworkId = "bridge";
// }

_LNUnitBuilder.AddBitcoinCoreNode();
_LNUnitBuilder.AddBitcoinCoreNode("miner","bitcoin","27.0rc1",pullImage:false);
_LNUnitBuilder.AddPolarLNDNode("alice", new List<LNUnitNetworkDefinition.Channel>
{
new()
Expand Down
2 changes: 1 addition & 1 deletion LNUnit.Tests/DataSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace LNUnit.Tests;

public partial class ABCLightningScenario
public partial class ABCLightningScenario
{
[Test]
[Category("Payment")]
Expand Down
8 changes: 7 additions & 1 deletion LNUnit.Tests/DockerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ private string GetRandomHexString(int size = 8)
[Category("Docker")]
public async Task BuildDockerImage()
{
await _client.CreateDockerImageFromPath("./../../../../Docker/", new List<string> { "polar_lnd_0_16_1_test" });
await _client.CreateDockerImageFromPath("./../../../../Docker/lnd", new List<string> { "custom_lnd","custom_lnd:latest" });
}
[Test]
[Category("Docker")]
public async Task BuildBitcoin_27_0_rc1_DockerImage()
{
await _client.CreateDockerImageFromPath("./../../../../Docker/bitcoin/27.0rc1", new List<string> { "bitcoin:27.0rc1" });
}


Expand Down
7 changes: 1 addition & 6 deletions LNUnit.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
<s:Boolean x:Key="/Default/CodeEditing/SuppressUninitializedWarningFix/Enabled/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LND/@EntryIndexedValue">LND</s:String>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNBolt_002ETests_003B_002A_003B_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002EController_003B_002A_003B_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNBolt_003B_002A_003B_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BAutopilotrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BChainrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BDevrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BInvoicesrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BLnrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BLNUnit_002EExtentions_002ELNDExtensions_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BLNUnit_002ELND_002ELNDChannelInterceptorHandler_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BLNUnit_002ELND_002ELNDCustomMessageHandler_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BNeutrinorpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BPeersrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BRouterrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -19,9 +16,7 @@
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BWalletrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BWatchtowerrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ELND_003B_002A_003BWtclientrpc_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ETests_003B_002A_003BLNUnit_002ETests_002ETests_003BResetContainer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_002ETests_003B_002A_003B_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=LNUnit_003B_002A_003BProgram_003B_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=maxpendingchannels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=noseedbackup/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=restlisten/@EntryIndexedValue">True</s:Boolean>
Expand Down
8 changes: 4 additions & 4 deletions LNUnit/Setup/LNUnitBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -783,14 +783,14 @@ public static class LNUnitBuilderExtensions
}


public static LNUnitBuilder AddBitcoinCoreNode(this LNUnitBuilder b, string name = "miner", bool txIndex = true)
public static LNUnitBuilder AddBitcoinCoreNode(this LNUnitBuilder b, string name = "miner", string image = "polarlightning/bitcoind", string tag= "26.0", bool txIndex = true,bool pullImage = true)
{
return b.AddBitcoinCoreNode(new LNUnitNetworkDefinition.BitcoinNode
{
Image = "polarlightning/bitcoind",
Tag = "24.0",
Image = image,
Tag = tag,
Name = name,
PullImage = true,
PullImage = pullImage,
EnvironmentVariables = new Dictionary<string, string>(),
Cmd = new List<string>
{
Expand Down

0 comments on commit bf0ae31

Please sign in to comment.