Neon-AI commited on
Commit
96c4e53
·
verified ·
1 Parent(s): 7cb5c1a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -12
Dockerfile CHANGED
@@ -1,30 +1,56 @@
1
  # syntax=docker/dockerfile:1.6
2
  FROM node:20-slim
3
 
4
- RUN apt-get update && apt-get install -y git curl ca-certificates && rm -rf /var/lib/apt/lists/*
5
-
6
- # Install Git LFS
7
- RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
8
- RUN apt-get install -y git-lfs
9
- RUN git lfs install
10
-
 
 
 
 
 
 
 
 
 
11
  WORKDIR /app
12
 
13
- # Clone private repo (with LFS)
 
 
14
  RUN --mount=type=secret,id=GH_TOKEN \
15
  git clone https://$(cat /run/secrets/GH_TOKEN)@github.com/IMaduwike/telebot-api.git temp
16
 
17
- # Pull LFS files
18
- WORKDIR temp
 
 
 
19
  RUN git lfs pull
20
 
21
- # Move app files and binary
 
 
 
 
22
  RUN mv server.js package.json start.sh /app/ \
23
  && mv telegram-bot-api /usr/local/bin/telegram-bot-api \
24
- && chmod +x start.sh /usr/local/bin/telegram-bot-api
 
25
 
26
  WORKDIR /app
 
 
 
 
27
  RUN npm install
28
 
 
 
 
29
  EXPOSE 7860
30
  CMD ["./start.sh"]
 
1
  # syntax=docker/dockerfile:1.6
2
  FROM node:20-slim
3
 
4
+ # ---------------------------
5
+ # 1️⃣ Install git, curl, and dependencies for Git LFS
6
+ # ---------------------------
7
+ RUN apt-get update && \
8
+ apt-get install -y git curl ca-certificates && \
9
+ rm -rf /var/lib/apt/lists/*
10
+
11
+ # ---------------------------
12
+ # 2️⃣ Install Git LFS manually (avoids gnupg issue in slim image)
13
+ # ---------------------------
14
+ RUN curl -sSL https://github.com/git-lfs/git-lfs/releases/download/v3.4.0/git-lfs-linux-amd64-v3.4.0.tar.gz \
15
+ | tar -xz -C /usr/local && /usr/local/git-lfs install
16
+
17
+ # ---------------------------
18
+ # 3️⃣ Set working directory for app
19
+ # ---------------------------
20
  WORKDIR /app
21
 
22
+ # ---------------------------
23
+ # 4️⃣ Clone private GitHub repo using HF Space secret
24
+ # ---------------------------
25
  RUN --mount=type=secret,id=GH_TOKEN \
26
  git clone https://$(cat /run/secrets/GH_TOKEN)@github.com/IMaduwike/telebot-api.git temp
27
 
28
+ WORKDIR /app/temp
29
+
30
+ # ---------------------------
31
+ # 5️⃣ Pull LFS files (ensures the real binary is downloaded)
32
+ # ---------------------------
33
  RUN git lfs pull
34
 
35
+ # ---------------------------
36
+ # 6️⃣ Move files to correct locations
37
+ # ---------------------------
38
+ # App files → /app
39
+ # Binary → /usr/local/bin
40
  RUN mv server.js package.json start.sh /app/ \
41
  && mv telegram-bot-api /usr/local/bin/telegram-bot-api \
42
+ && chmod +x /usr/local/bin/telegram-bot-api start.sh \
43
+ && rm -rf /app/temp
44
 
45
  WORKDIR /app
46
+
47
+ # ---------------------------
48
+ # 7️⃣ Install Node dependencies
49
+ # ---------------------------
50
  RUN npm install
51
 
52
+ # ---------------------------
53
+ # 8️⃣ Expose port and run app
54
+ # ---------------------------
55
  EXPOSE 7860
56
  CMD ["./start.sh"]