Skip to content

Commit 80e71dd

Browse files
committed
Docker setup
1 parent 7e4744e commit 80e71dd

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,32 +105,38 @@
105105

106106
First, clone the repository from GitHub:
107107

108-
```bash
109-
git clone https://github.com/FlyingFathead/TelegramBot-OpenAI-API.git
110-
cd TelegramBot-OpenAI-API
111-
```
108+
```bash
109+
git clone https://github.com/FlyingFathead/TelegramBot-OpenAI-API.git
110+
cd TelegramBot-OpenAI-API
111+
```
112112

113113
### **Step 2: Run the Setup Script**
114114

115115
This project includes a setup script that will guide you through entering your API keys and generating a `.env` file.
116116

117117
Run the script:
118118

119-
```bash
120-
./docker_setup.sh
121-
```
119+
```bash
120+
./docker_setup.sh
121+
```
122122

123123
Follow the instructions provided by the script. It will ask for your OpenAI API key and Telegram Bot API key, validate them, and create a `.env` file with your credentials.
124124

125125
### **Step 3: Build the Docker Image**
126126

127127
Once your `.env` file has been created, you need to build the Docker image.
128128

129-
Run the following command to build the Docker image:
129+
You can run the featured `docker_deploy.sh` to build the Docker image:
130+
131+
```bash
132+
sudo ./docker_deploy.sh
133+
```
134+
135+
Or, you can build it manually:
130136

131-
```bash
132-
sudo docker build -t telegrambot-openai-api .
133-
```
137+
```bash
138+
sudo docker build -t telegrambot-openai-api .
139+
```
134140

135141
This will build the image locally based on the `Dockerfile` in the repository.
136142

@@ -140,9 +146,9 @@ After the image is successfully built, you can start the bot in a Docker contain
140146

141147
Run the container with the following command:
142148

143-
```bash
144-
sudo docker run --env-file .env -d telegrambot-openai-api
145-
```
149+
```bash
150+
sudo docker run --env-file .env --name telegrambot-openai-api -d telegrambot-openai-api
151+
```
146152

147153
- The `-d` flag runs the container in detached mode (in the background).
148154
- The `--env-file .env` flag injects your API keys into the container.
@@ -151,19 +157,19 @@ sudo docker run --env-file .env -d telegrambot-openai-api
151157

152158
You can check if the container is running by using:
153159

154-
```bash
155-
sudo docker ps
156-
```
160+
```bash
161+
sudo docker ps
162+
```
157163

158164
This will list all running containers. If your bot is running correctly, it should appear in the list.
159165

160166
### **Step 6: Stopping the Container**
161167

162168
If you need to stop the bot, you can do so by running:
163169

164-
```bash
165-
sudo docker stop <container_id>
166-
```
170+
```bash
171+
sudo docker stop <container_id>
172+
```
167173

168174
Replace `<container_id>` with the actual container ID, which you can obtain from the `docker ps` output.
169175

0 commit comments

Comments
 (0)