From 735efca5f3592ff9085d785aa78af889bcaade80 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Wed, 28 May 2025 18:04:31 +0530 Subject: [PATCH] added docker related files --- .env-example | 5 +++++ Dockerfile | 14 +++++++++++++ docker-compose.yaml | 14 +++++++++++++ docker-readme.md | 51 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 .env-example create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100644 docker-readme.md diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..079d435 --- /dev/null +++ b/.env-example @@ -0,0 +1,5 @@ +KITE_API_KEY=YOUR_KITE_API_KEY +KITE_API_SECRET=YOUR_KITE_API_SECRET +APP_MODE=sse +APP_HOST=0.0.0.0 +APP_PORT=8080 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3086108 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.24.2-alpine + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . + +RUN go build -o /app/kite-mcp-server . + +EXPOSE 8080 + +ENTRYPOINT ["/app/kite-mcp-server"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..1ceb7ae --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + kite-mcp-server: + build: . + image: zerodha-mcp:prod + ports: + - "8080:8080" + environment: + KITE_API_KEY: ${KITE_API_KEY} + KITE_API_SECRET: ${KITE_API_SECRET} + APP_MODE: ${APP_MODE:-sse} + APP_HOST: ${APP_HOST:-0.0.0.0} + APP_PORT: ${APP_PORT:-8080} \ No newline at end of file diff --git a/docker-readme.md b/docker-readme.md new file mode 100644 index 0000000..64f2918 --- /dev/null +++ b/docker-readme.md @@ -0,0 +1,51 @@ +# Docker Setup and Running Instructions + +This document provides instructions on how to set up and run the application using Docker and Docker Compose. + +## Prerequisites + +Before you begin, ensure you have the following installed on your system: + +* Docker: Follow the official installation guide for your operating system. +* Docker Compose: Follow the official installation guide for your operating system. + +## Setup + +1. **Environment Variables:** + Create a `.env` file in the same directory as the `docker-compose.yaml` file. This file will contain the environment variables required by the application. Add the following content to the `.env` file: + + ```env + KITE_API_KEY=YOUR_KITE_API_KEY + KITE_API_SECRET=YOUR_KITE_API_SECRET + APP_MODE=sse + APP_HOST=0.0.0.0 + APP_PORT=8080 + ``` + + **Replace `YOUR_KITE_API_KEY` and `YOUR_KITE_API_SECRET` with your actual Kite API credentials.** + +2. **Dockerfile:** + Ensure a `Dockerfile` exists in the same directory as the `docker-compose.yaml` file. This file contains the instructions to build the Docker image. + +## Running the Application + +1. **Build and Run:** + Open your terminal, navigate to the directory containing the `docker-compose.yaml` and `.env` files, and run the following command: + + ```bash + docker compose up --build -d + ``` + + * `--build`: This flag tells Docker Compose to build the images before starting the containers. + * `-d`: This flag runs the containers in detached mode (in the background). + +2. **Stopping the Application:** + To stop the running containers, use the following command in the same directory: + + ```bash + docker compose down + ``` + +## Accessing the Application + +The application should be accessible on `http://localhost:8080` (or the IP address of your server if not running locally) after the containers are up and running. \ No newline at end of file