From 8025c950ce834b838c15f19134f7c9caa10798f6 Mon Sep 17 00:00:00 2001 From: mani1soni Date: Thu, 18 Jan 2024 13:07:52 +0530 Subject: [PATCH 1/3] Added Dockerfile and related Document file --- Dockerfile | 23 +++++++++++++++ docker-doc.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-doc.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..050cbc8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Use an official Node.js runtime as a parent image +FROM node:latest + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json (and package-lock.json if available) into the container +COPY package*.json ./ + +# Install any dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Make port 8080 available to the world outside this container +EXPOSE 8080 + +# Define environment variable (replace with actual key or use Docker's -e flag) +ENV GOOGLE_API_KEY="AIzaSyD-lRmBi5TVlpyJ38-Zzc-9s3-tp-1fKwY" + +# Run the application +CMD ["npm", "start"] diff --git a/docker-doc.md b/docker-doc.md new file mode 100644 index 0000000..c12ca91 --- /dev/null +++ b/docker-doc.md @@ -0,0 +1,78 @@ +# Using "Thala For Reason" with Docker + +## Introduction + +"Thala For Reason" is a Node.js-based web application. This guide provides instructions on how to run it using Docker, which simplifies setup and ensures consistency across different environments. + +## Prerequisites + +- Docker installed on your machine (Linux, Windows, or macOS). +- A Google API key. + +## Installing Docker + +### Linux + +1. Update your package index: + ``` + sudo apt-get update + ``` + +2. Install Docker: + ``` + sudo apt-get install docker-ce docker-ce-cli containerd.io + ``` + +3. Verify the Docker installation: + ``` + sudo docker run hello-world + ``` + +### Windows + +1. Download Docker Desktop from [Docker Hub](https://hub.docker.com/). +2. Run the installer and follow the instructions. +3. Open Docker Desktop to complete the installation. + +### macOS + +1. Download Docker Desktop from [Docker Hub](https://hub.docker.com/). +2. Double-click the DMG file and drag the Docker icon to the Applications folder. +3. Open Docker from the Applications folder. + +## Creating a Google API Key + +1. Go to the [Google Cloud Console](https://console.cloud.google.com/). +2. Create a new project or select an existing one. +3. Navigate to "APIs & Services" > "Credentials". +4. Click "Create Credentials" and select "API key". +5. Copy the generated API key for later use. + +## Running the Application with Docker + +1. Clone the repository: + ``` + git clone https://github.com/your-username/thala-for-reason.git + ``` + +2. Navigate to the project directory: + ``` + cd thala-for-reason + ``` + +3. Build the Docker image: + ``` + docker build -t thala-for-reason . + ``` + +4. Run the Docker container, replacing `your_google_api_key` with your actual Google API key: + ``` + docker run -itd -p 80:8080 -e GOOGLE_API_KEY=your_google_api_key thala-for-reason + ``` + +5. Access the application at `http://localhost:80`. + +## Notes + +- It's important to keep your Google API key secure. Do not hardcode it in your Dockerfile or source code. +- For detailed Docker installation instructions, refer to the official Docker documentation. From a58477781f08ecbdec05e8198127e5c48b9a96ec Mon Sep 17 00:00:00 2001 From: Manish Soni Date: Thu, 18 Jan 2024 13:11:08 +0530 Subject: [PATCH 2/3] Update docker-doc.md --- docker-doc.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docker-doc.md b/docker-doc.md index c12ca91..8c41e7f 100644 --- a/docker-doc.md +++ b/docker-doc.md @@ -42,11 +42,7 @@ ## Creating a Google API Key -1. Go to the [Google Cloud Console](https://console.cloud.google.com/). -2. Create a new project or select an existing one. -3. Navigate to "APIs & Services" > "Credentials". -4. Click "Create Credentials" and select "API key". -5. Copy the generated API key for later use. + Go to the [Google API key](https://makersuite.google.com/) here and generate your keys. ## Running the Application with Docker From 082ae31062ebdb232b08f86bbca82757c366ee5c Mon Sep 17 00:00:00 2001 From: Manish Soni Date: Thu, 18 Jan 2024 13:17:41 +0530 Subject: [PATCH 3/3] Update Dockerfile to remove my Google Key --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 050cbc8..42ab591 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ COPY . . EXPOSE 8080 # Define environment variable (replace with actual key or use Docker's -e flag) -ENV GOOGLE_API_KEY="AIzaSyD-lRmBi5TVlpyJ38-Zzc-9s3-tp-1fKwY" +ENV GOOGLE_API_KEY="Your_Key" # Run the application CMD ["npm", "start"]