privateone commited on
Commit
48500af
Β·
verified Β·
1 Parent(s): 7be7979

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +43 -0
  2. app.json +99 -0
  3. init.sh +82 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #FROM dperson/openvpn-client
2
+ FROM nikolaik/python-nodejs:python3.9-nodejs18
3
+
4
+ ENV USERNAME=admin
5
+ # Create and use a non-root user
6
+ RUN useradd -ms /bin/bash $USERNAME
7
+
8
+ # Set working directory for the application
9
+ WORKDIR /app
10
+
11
+
12
+ RUN apt-get update -y && apt-get upgrade -y \
13
+ && apt-get install -y --no-install-recommends ffmpeg \
14
+ #&& apt-get install -y openvpn \
15
+ && apt-get install -y git-all \
16
+ && apt-get clean \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ ENV HOME=/home/$USERNAME
20
+ RUN mkdir $HOME/.cache $HOME/.config \
21
+ && chmod -R 777 $HOME
22
+
23
+ ENV PATH=$HOME/.local/bin:$PATH
24
+
25
+ COPY init.sh /app/init.sh
26
+ RUN chmod +x /app/init.sh
27
+ RUN /app/init.sh
28
+
29
+ # Set ownership and permissions for the app directory
30
+ RUN chown -R admin:admin /app && chmod -R 777 /app
31
+
32
+ # Switch to the non-root user for better security
33
+ USER admin
34
+
35
+ # Expose the port the application will run on
36
+ EXPOSE 7860
37
+
38
+ # Use init.sh as the entrypoint so it runs on container start
39
+ ENTRYPOINT ["/app/init.sh"]
40
+ # Run the VPN script when the container starts
41
+
42
+ #CMD ["sh","/start_vpn.sh"]
43
+ CMD ["python", "-u","-m", "YukkiMusic"]
app.json ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Yukki Music Bot",
3
+ "description": "Telegram Group Calls streaming bot with some useful features, written in Python with Pyrogram and Py-Tgcalls. Supporting platforms like Youtube, Spotify, Resso, AppleMusic, Soundcloud and M3u8 Links.",
4
+ "logo": "https://telegra.ph/file/c0e014ff34f34d1056627.png",
5
+ "keywords": [
6
+ "python3",
7
+ "telegram",
8
+ "bot",
9
+ "Yukki",
10
+ "YukkiMusicBot",
11
+ "telegram-bot",
12
+ "pyrogram"
13
+ ],
14
+ "stack": "container",
15
+ "env": {
16
+ "API_ID": {
17
+ "description": "Get this value from https://my.telegram.org",
18
+ "value": "",
19
+ "required": true
20
+ },
21
+ "API_HASH": {
22
+ "description": "Get this value from https://my.telegram.org",
23
+ "value": "",
24
+ "required": true
25
+ },
26
+ "AUTO_LEAVING_ASSISTANT": {
27
+ "description": "If you want your assistant to leave all chats automatically after some time.",
28
+ "value": "True",
29
+ "required": false
30
+ },
31
+ "BOT_TOKEN": {
32
+ "description": "A Bot's token from Botfather",
33
+ "value": "",
34
+ "required": true
35
+ },
36
+ "MONGO_DB_URI": {
37
+ "description": "Get a mongodb url from https://cloud.mongodb.com . You can leave it blank if you want , bot will use Yukki's database for you.",
38
+ "value": "",
39
+ "required": true
40
+ },
41
+ "MUSIC_BOT_NAME": {
42
+ "description": "A name for your Music Bot. Please don't use ascii characters",
43
+ "value": "",
44
+ "required": true
45
+ },
46
+ "OWNER_ID": {
47
+ "description": "The user id(s) of user(s) whom you would like to add as a OWNER. Multiple values shall be seperated with a space.",
48
+ "value": "",
49
+ "required": true
50
+ },
51
+ "STRING_SESSION": {
52
+ "description": "A Pyrogram String Session. One Assistant is Compulsory.",
53
+ "value": "",
54
+ "required": true
55
+ },
56
+ "HEROKU_API_KEY": {
57
+ "description": "Your Heroku account's API key",
58
+ "value": "",
59
+ "required": false
60
+ },
61
+ "HEROKU_APP_NAME": {
62
+ "description": "Your heroku app/bot's name",
63
+ "value": "",
64
+ "required": false
65
+ },
66
+ "LOG_GROUP_ID": {
67
+ "description": "Your Log Group ID, add your bot and promote as an admin with full rights!. Use only Group. Please don't use Channel ID.",
68
+ "value": "",
69
+ "required": true
70
+ },
71
+ "UPSTREAM_REPO": {
72
+ "description": "If you dont know this, Leave as it is",
73
+ "value": "https://github.com/TeamYukki/YukkiMusicBot",
74
+ "required": true
75
+ },
76
+ "UPSTREAM_BRANCH": {
77
+ "description": "Upstream Repo's Branch Name",
78
+ "value": "master",
79
+ "required": true
80
+ }
81
+ },
82
+ "buildpacks": [
83
+ {
84
+ "url": "heroku/python"
85
+ },
86
+ {
87
+ "url": "heroku/nodejs"
88
+ },
89
+ {
90
+ "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git"
91
+ }
92
+ ],
93
+ "formation": {
94
+ "worker": {
95
+ "quantity": 1,
96
+ "size": "free"
97
+ }
98
+ }
99
+ }
init.sh ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e # Exit if any command fails
3
+
4
+ # echo "πŸ” GITHUB_PAT: ${GITHUB_PAT}" # Mask token in logs
5
+
6
+ # Define variables
7
+ #REPO_URL="https://github.com/blendersb/teleapi.git"
8
+ BRANCH="${BRANCH:=main}"
9
+ TARGET_DIR="/app/One_Stream"
10
+ APP_DIR="/app"
11
+
12
+ # Only clone if GITHUB_PAT is set
13
+ if [ -n "$GITHUB_PATH" ]; then
14
+ echo "πŸ“₯ GITHUB_PAT detected. Cloning private repository..."
15
+
16
+ # Clone only if the target directory does not exist
17
+ if [ ! -d "$TARGET_DIR" ]; then
18
+
19
+ if [ -n "$CODE_REPO" ]; then
20
+ echo "πŸ“₯ CODE_REPOSITRY detected. Cloning private repository..."
21
+ git clone -b "$BRANCH" "$CODE_REPO" "$TARGET_DIR"
22
+ else
23
+ echo "πŸ“₯ Cloning private repository..."
24
+ git clone -b "$BRANCH" "$GITHUB_PATH" "$TARGET_DIR"
25
+ fi
26
+
27
+ cd "$TARGET_DIR"
28
+
29
+ echo "πŸ“ Latest Git Commit:"
30
+ git log -1 --pretty=format:"πŸ”Ή %h πŸ”Ή %s πŸ”Ή by %an πŸ”Ή on %ad" --date=short
31
+ echo
32
+
33
+
34
+ echo "πŸ“‚ Moving contents from $TARGET_DIR to $APP_DIR..."
35
+ shopt -s dotglob # include hidden files like .env, .gitignore
36
+ mv "$TARGET_DIR"/* "$APP_DIR"/
37
+ rm -rf "$TARGET_DIR"
38
+ shopt -u dotglob
39
+
40
+ # Set permissions (optional)
41
+ #echo "πŸ”§ Setting main folder permissions..."
42
+ #chmod -R +x "$APP_DIR"
43
+ #chmod -R 777 "$APP_DIR"
44
+ ls -la "$APP_DIR"
45
+ #echo "πŸ”§ Setting up sessions & permissions..."
46
+ #SESSION_DIR="$APP_DIR/sessions"
47
+ #chmod -R 777 "$APP_DIR/sessions"
48
+
49
+ #echo "πŸ” Scanning files in: $SESSION_DIR"
50
+ #echo
51
+
52
+ #find "$SESSION_DIR" -type f | while read -r file; do
53
+ # perms=$(stat -c "%A" "$file") # Get permission string
54
+ # if [ -w "$file" ]; then
55
+ # writable="βœ… Writable"
56
+ # else
57
+ # writable="❌ Not Writable"
58
+ # fi
59
+ # echo "$perms $writable β†’ $file"
60
+ # # rm -rf "$file"
61
+ #done
62
+
63
+ else
64
+ echo "βœ… Repository already cloned at $TARGET_DIR"
65
+ fi
66
+
67
+ # Change to repo directory
68
+ cd "$APP_DIR"
69
+
70
+ # Install Python dependencies
71
+ if [ -f "$APP_DIR/requirements.txt" ]; then
72
+ echo "πŸ“¦ Installing Python dependencies..."
73
+ pip3 install --no-cache-dir --upgrade -r "requirements.txt"
74
+ else
75
+ echo "⚠️ No requirements.txt found in $APP_DIR"
76
+ fi
77
+ echo "βœ… Init script complete. Starting application..."
78
+ # Start the actual app (from CMD)
79
+ exec "$@"
80
+ else
81
+ echo "ℹ️ GITHUB_PAT not set. Skipping clone step."
82
+ fi