Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker for Relayers #10

Merged
merged 2 commits into from
Sep 29, 2024
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
40 changes: 40 additions & 0 deletions .github/workflows/Docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Push Docker Image

on:
push:
branches:
- main # Change this to your default branch

jobs:
build_and_push:
runs-on: ubuntu-latest

env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: secretpath
IMAGE_TAG: latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
run: |
docker-compose build
docker-compose push
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.idea
TNLS-Relayers/etherscan_api_key.txt
*/.*
*/venv
*/__pycache__
.DS_Store
Expand Down Expand Up @@ -30,6 +28,5 @@ TNLS-Samples/RNG/contract.wasm.gz
/venv
/TNLS-Gateways/solana-gateway/.anchor/program-logs
/secret-deploy/node_modules
secret-deploy/secret_gateway.log
secret-deploy/secret_sample.log
/secret-deploy/node_modules
/secret-deploy/secret_gateway.log
/secret-deploy/secret_sample.log
3 changes: 3 additions & 0 deletions TNLS-Relayers/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ethereum-private-key = XXXXX
solana-private-key = XXXXX
secret-private-key = XXXXX
20 changes: 20 additions & 0 deletions TNLS-Relayers/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Python 3.11 runtime
FROM python:3.11-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install the dependencies specified in requirements.txt
RUN pip install --no-dependencies -r requirements.txt

# Copy the rest of your application code into the container
COPY . .

# Expose the port your app runs on
EXPOSE 8000

# Command to the relayer
CMD ["python3", "web_app.py"]
17 changes: 17 additions & 0 deletions TNLS-Relayers/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.8'

services:
tnls-relayer:
build:
context: ./ # Path to the build context
dockerfile: Dockerfile
image: your-dockerhub-username/your-image-name:latest
container_name: tnls-relayer
ports:
- "8000:8000" # Maps port 8000 on host to port 8000 in container
volumes:
- ./config.yml:/app/config.yml # Volume mapping for config.yml
environment: {}
#- ENV_VAR1=value1
#- ENV_VAR2=value2
restart: unless-stopped # Automatically restart container on failure