From 338442006b811725ea8006f073fe26b5e9d6d3b1 Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode <123783602+HolgerHatGarKeineNode@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:49:30 +0000 Subject: [PATCH] Add Dockerfile and Docker Compose for wot-relay setup Introduced a Dockerfile to build the wot-relay application using the Golang image based on Debian Bookworm. Configured the working directory, cloned the repository, downloaded Go module dependencies, set environment variables, and built the Go application. Exposed port 3334 and set the command to run the executable. Added a Docker Compose file for streamlined service deployment, including environment variable configurations, volume binding for the database directory, and port mapping. --- Dockerfile | 27 +++++++++++++++++++++++++++ docker-compose.yml | 14 ++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..810ee65 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Use Golang image based on Debian Bookworm +FROM golang:bookworm + +# Set the working directory within the container +WORKDIR /app + +# Clone the repository +RUN git clone https://github.com/bitvora/wot-relay . + +# Download Go module dependencies +RUN go mod download + +# Write the .env file +RUN touch .env && \ + echo "RELAY_NAME=${RELAY_NAME}" >> .env && \ + echo "RELAY_PUBKEY=${RELAY_PUBKEY}" >> .env && \ + echo "RELAY_DESCRIPTION=${RELAY_DESCRIPTION}" >> .env && \ + echo "DB_PATH=${DB_PATH}" >> .env + +# Build the Go application +RUN go build -o main . + +# Expose the port that the application will run on +EXPOSE 3334 + +# Set the command to run the executable +CMD ["./main"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5cf78f7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + wot-relay: + build: + context: . + dockerfile: Dockerfile + environment: + RELAY_NAME: "utxo WoT relay" + RELAY_PUBKEY: "e2ccf7cf20403f3f2a4a55b328f0de3be38558a7d5f33632fdaaefc726c1c8eb" + RELAY_DESCRIPTION: "Only notes in utxo WoT" + DB_PATH: "./db" + volumes: + - "./db:/app/db" + ports: + - "3334:3334" \ No newline at end of file