Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/backends/compose/compose_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ def default_config_args(self, tank):
return defaults

def copy_configs(self, tank):
warnet_tor_dir = tank.config_dir / "tor"
warnet_tor_dir.mkdir()
shutil.copyfile(TEMPLATES / DOCKERFILE_NAME, tank.config_dir / DOCKERFILE_NAME)
shutil.copyfile(TEMPLATES / "tor" / TORRC_NAME, tank.config_dir / TORRC_NAME)
shutil.copyfile(TEMPLATES / "tor" / TORRC_NAME, warnet_tor_dir / TORRC_NAME)
shutil.copyfile(TEMPLATES / ENTRYPOINT_NAME, tank.config_dir / ENTRYPOINT_NAME)
set_execute_permission(tank.config_dir / ENTRYPOINT_NAME)

Expand Down
2 changes: 1 addition & 1 deletion src/templates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ RUN set -ex \
COPY --from=builder /usr/local/bin/bitcoind /usr/local/bin/bitcoin-cli /usr/local/bin/
COPY entrypoint.sh /entrypoint.sh
# Warnet torrc using test network
COPY torrc /etc/tor/warnet-torr
COPY tor/torrc /etc/tor/warnet-torr

VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18443 18444 38333 38332
Expand Down
2 changes: 1 addition & 1 deletion src/templates/Dockerfile_k8
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ RUN set -ex \
COPY --from=builder /usr/local/bin/bitcoind /usr/local/bin/bitcoin-cli /usr/local/bin/
COPY entrypoint.sh /entrypoint.sh
# Warnet torrc using test network
COPY torrc /etc/tor/warnet-torr
COPY tor/torrc /etc/tor/warnet-torr

VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18443 18444 38333 38332
Expand Down
2 changes: 1 addition & 1 deletion src/templates/isroutable.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 7530334db1..b66cfe5c2f 100644
bool CNetAddr::IsRoutable() const
{
- return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || IsRFC4193() || IsRFC4843() || IsRFC7343() || IsLocal() || IsInternal());
+ return IsValid() && !(IsLocal() || IsInternal());
+ return true;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/templates/tor/Dockerfile_tor_da
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ RUN chown -R debian-tor:debian-tor /home/debian-tor
RUN mkdir -p /var/log/tor
RUN chown -R debian-tor:debian-tor /var/log/tor

COPY tor-keys /home/debian-tor/.tor/keys
COPY tor/tor-keys /home/debian-tor/.tor/keys
RUN chown -R debian-tor:debian-tor /home/debian-tor/.tor/keys
COPY torrc.da /etc/tor/torrc
COPY tor/torrc.da /etc/tor/torrc

EXPOSE 9050

Expand Down
4 changes: 2 additions & 2 deletions src/templates/tor/Dockerfile_tor_relay
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ RUN chown -R debian-tor:debian-tor /home/debian-tor
RUN mkdir -p /var/log/tor
RUN chown -R debian-tor:debian-tor /var/log/tor

COPY torrc.relay /etc/tor/torrc
COPY tor/torrc.relay /etc/tor/torrc

EXPOSE 9050

COPY tor-entrypoint.sh /entrypoint.sh
COPY tor/tor-entrypoint.sh /entrypoint.sh
ENTRYPOINT /entrypoint.sh
CMD ["tor", "-f", "/etc/tor/torrc"]
34 changes: 20 additions & 14 deletions src/utils/image_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ def build_and_upload_images(

# Setup buildkit
builder_name = "warnet-builder"
if not run_command(f"docker buildx create --name {builder_name} --use"):
return False
create_builder_cmd = f"docker buildx create --name {builder_name} --use"
use_builder_cmd = f"docker buildx use --builder {builder_name}"
cleanup_builder_cmd = f"docker buildx rm {builder_name}"

if not run_command(create_builder_cmd): # noqa: SIM102
# try to use existing
if not run_command(use_builder_cmd):
print(f"Could create or use builder {builder_name} and create new builder")
return False

image_full_name = f"{docker_registry}:{tag}"
print(f"Image full name: {image_full_name}")

platforms = ','.join([f"linux/{arch}" for arch in build_arches])
platforms = ",".join([f"linux/{arch}" for arch in build_arches])

build_command = (
f"docker buildx build"
Expand All @@ -76,14 +83,13 @@ def build_and_upload_images(
)
print(f"{build_command=:}")

if not run_command(build_command):
return False

# Tidy up the buildx builder
cleanup_command = f"docker buildx rm {builder_name}"
if not run_command(cleanup_command):
print("Warning: Failed to remove the buildx builder.")
else:
print("Buildx builder removed successfully.")

return True
try:
res = run_command(build_command)
finally:
# Tidy up the buildx builder
if not run_command(cleanup_builder_cmd):
print("Warning: Failed to remove the buildx builder.")
else:
print("Buildx builder removed successfully.")

return bool(res)