diff --git a/.github/workflows/Docker_image.yml b/.github/workflows/Docker_image.yml new file mode 100644 index 0000000..267d97d --- /dev/null +++ b/.github/workflows/Docker_image.yml @@ -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 diff --git a/.gitignore b/.gitignore index d9127fc..a47ef39 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ .idea -TNLS-Relayers/etherscan_api_key.txt -*/.* */venv */__pycache__ .DS_Store @@ -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 diff --git a/TNLS-Relayers/.env.example b/TNLS-Relayers/.env.example new file mode 100644 index 0000000..af35005 --- /dev/null +++ b/TNLS-Relayers/.env.example @@ -0,0 +1,3 @@ +ethereum-private-key = XXXXX +solana-private-key = XXXXX +secret-private-key = XXXXX diff --git a/TNLS-Relayers/Dockerfile b/TNLS-Relayers/Dockerfile new file mode 100644 index 0000000..e65f677 --- /dev/null +++ b/TNLS-Relayers/Dockerfile @@ -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"] \ No newline at end of file diff --git a/TNLS-Relayers/docker-compose.yml b/TNLS-Relayers/docker-compose.yml new file mode 100644 index 0000000..d5ce96c --- /dev/null +++ b/TNLS-Relayers/docker-compose.yml @@ -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