Neon-AI commited on
Commit
093ebe4
·
verified ·
1 Parent(s): 2e91c24

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -14
Dockerfile CHANGED
@@ -1,7 +1,6 @@
1
- # syntax=docker/dockerfile:1.6
2
  FROM node:20-slim
3
 
4
- # 1️⃣ Install git, curl, and certificates
5
  RUN apt-get update && \
6
  apt-get install -y git curl ca-certificates && \
7
  rm -rf /var/lib/apt/lists/*
@@ -15,7 +14,7 @@ RUN curl -sSL https://github.com/git-lfs/git-lfs/releases/download/v3.4.0/git-lf
15
 
16
  WORKDIR /app
17
 
18
- # 3️⃣ Clone private repo securely using HF secret GH_TOKEN
19
  RUN --mount=type=secret,id=GH_TOKEN \
20
  git clone https://$(cat /run/secrets/GH_TOKEN)@github.com/IMaduwike/telebot-api.git temp
21
 
@@ -24,17 +23,20 @@ WORKDIR /app/temp
24
  # 4️⃣ Pull the real binary using Git LFS
25
  RUN git lfs pull
26
 
27
- # 5️⃣ Verify files
28
- RUN ls -lh
29
-
30
- # 6️⃣ Move binary and app files
31
- # Adjust start.sh path if inside scripts/ folder
32
- RUN mv telegram-bot-api /usr/local/bin/telegram-bot-api && \
33
- chmod +x /usr/local/bin/telegram-bot-api && \
34
- mv server.js package.json start.sh /app/ 2>/dev/null || \
35
- mv server.js package.json scripts/start.sh /app/start.sh && \
36
- chmod +x /app/start.sh && \
37
- rm -rf /app/temp
 
 
 
38
 
39
  WORKDIR /app
40
 
@@ -42,4 +44,6 @@ WORKDIR /app
42
  RUN npm install
43
 
44
  EXPOSE 7860
 
 
45
  CMD ["./start.sh"]
 
 
1
  FROM node:20-slim
2
 
3
+ # 1️⃣ Install git, curl, certificates
4
  RUN apt-get update && \
5
  apt-get install -y git curl ca-certificates && \
6
  rm -rf /var/lib/apt/lists/*
 
14
 
15
  WORKDIR /app
16
 
17
+ # 3️⃣ Clone private repo securely using GH_TOKEN secret
18
  RUN --mount=type=secret,id=GH_TOKEN \
19
  git clone https://$(cat /run/secrets/GH_TOKEN)@github.com/IMaduwike/telebot-api.git temp
20
 
 
23
  # 4️⃣ Pull the real binary using Git LFS
24
  RUN git lfs pull
25
 
26
+ # 5️⃣ Move binary and all app files automatically
27
+ # - Move telegram-bot-api binary to /usr/local/bin
28
+ # - Move everything else (js, package.json, start.sh) to /app
29
+ RUN find . -maxdepth 1 -type f -exec sh -c ' \
30
+ for f; do \
31
+ if [ "$f" = "./telegram-bot-api" ]; then \
32
+ mv "$f" /usr/local/bin/telegram-bot-api && chmod +x /usr/local/bin/telegram-bot-api; \
33
+ else \
34
+ mv "$f" /app/; \
35
+ fi; \
36
+ done' sh {} +
37
+
38
+ # 6️⃣ Clean up
39
+ RUN rm -rf /app/temp
40
 
41
  WORKDIR /app
42
 
 
44
  RUN npm install
45
 
46
  EXPOSE 7860
47
+
48
+ # 8️⃣ Start TDLib + Node server
49
  CMD ["./start.sh"]