-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* beginning of ci/cd implementation * added ci-cd branch for testing * fix branches to build
- Loading branch information
Showing
8 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.env | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ WEBAPP_PORT = | |
TOKEN = "" | ||
ADMIN_ID_LIST = | ||
SUPPORT_LINK = "" | ||
DB_NAME = "" | ||
DB_NAME = "" | ||
NGROK_TOKEN = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: [master, feature/sqlalchemy-sqlcipher] | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/AiogramShopBot:latest | ||
- name: clean all | ||
run: rm -rf ./* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:3.9-slim | ||
|
||
WORKDIR /bot | ||
COPY . /bot/ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
ENV PYTHONUNBUFFERED=1 | ||
CMD ["python3", "-u", "/bot/main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
from ngrok_executor import start_ngrok | ||
|
||
load_dotenv() | ||
|
||
WEBHOOK_HOST = os.environ.get("WEBHOOK_HOST") | ||
WEBHOOK_HOST = start_ngrok() | ||
WEBHOOK_PATH = os.environ.get("WEBHOOK_PATH") | ||
WEBAPP_HOST = os.environ.get("WEBAPP_HOST") | ||
WEBAPP_PORT = os.environ.get("WEBAPP_PORT") | ||
DB_PASS = os.environ.get("DB_PASS") | ||
MNEMONIC = os.environ.get("MNEMONIC") | ||
WEBHOOK_URL = f"{WEBHOOK_HOST}{WEBHOOK_PATH}" | ||
TOKEN = os.environ.get("TOKEN") | ||
ADMIN_ID_LIST = os.environ.get("ADMIN_ID_LIST").split(',') | ||
ADMIN_ID_LIST = [int(admin_id) for admin_id in ADMIN_ID_LIST] | ||
SUPPORT_LINK = os.environ.get("SUPPORT_LINK") | ||
DB_NAME = os.environ.get("DB_NAME") | ||
DB_ENCRYPTION = os.environ.get("DB_ENCRYPTION") == "True" | ||
ADDITIVE = os.environ.get("ADDITIVE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: "3.8" | ||
services: | ||
bot: | ||
build: | ||
context: . | ||
container_name: 'AiogramShopBot' | ||
environment: | ||
WEBHOOK_PATH: "" | ||
WEBAPP_HOST: "0.0.0.0" # Don't touch this | ||
WEBAPP_PORT: 5000 # Here your port | ||
TOKEN: "1234567890:QWER.....TYI" # Here your bot token from botfather | ||
NGROK_TOKEN: 'NGROK_TOKEN_HERE' # Here your ngrok token from ngrok.com | ||
ADMIN_ID_LIST: 12345678,87654321 # Telegram ID's for admins; | ||
SUPPORT_LINK: "https://t.me/YourUsername" | ||
DB_NAME: "database.db" # Here your database name | ||
ports: | ||
- "4040:4040" | ||
- 5000:${WEBAPP_PORT} | ||
expose: | ||
- 4040 | ||
- ${WEBAPP_PORT} | ||
volumes: | ||
- /AiogramShopBot:/bot/${DB_NAME} | ||
|
||
volumes: | ||
AiogramShopBot: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os | ||
|
||
from pyngrok import ngrok | ||
|
||
|
||
def start_ngrok(): | ||
ngrok_token = os.environ.get("NGROK_TOKEN") | ||
port = os.environ.get("WEBAPP_PORT") | ||
ngrok.set_auth_token(ngrok_token) | ||
http_tunnel = ngrok.connect(f":{port}", "http") | ||
return http_tunnel.public_url |
Binary file not shown.