Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +26 -12
Dockerfile
CHANGED
|
@@ -1,43 +1,57 @@
|
|
|
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
| 4 |
RUN apt-get update && \
|
| 5 |
apt-get install -y git curl ca-certificates && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
|
|
|
| 8 |
# Install Git LFS
|
|
|
|
| 9 |
RUN curl -sSL https://github.com/git-lfs/git-lfs/releases/download/v3.4.0/git-lfs-linux-amd64-v3.4.0.tar.gz \
|
| 10 |
| tar -xz -C /tmp && \
|
| 11 |
mv /tmp/git-lfs-3.4.0/git-lfs /usr/local/bin/git-lfs && \
|
| 12 |
chmod +x /usr/local/bin/git-lfs && \
|
| 13 |
git lfs install
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
#
|
| 18 |
RUN rm -rf /app/* || true
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
RUN --mount=type=secret,id=GH_TOKEN \
|
| 21 |
git clone --depth=1 https://$(cat /run/secrets/GH_TOKEN)@github.com/IMaduwike/telebot-api.git . && \
|
| 22 |
-
rm -rf .git
|
|
|
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
RUN ls -lh
|
| 28 |
-
|
| 29 |
-
# Move binary to /usr/local/bin and make executable
|
| 30 |
RUN mv telegram-bot-api /usr/local/bin/telegram-bot-api && chmod +x /usr/local/bin/telegram-bot-api
|
| 31 |
|
| 32 |
-
#RUN ldd /usr/local/bin/
|
| 33 |
-
|
| 34 |
# Make sure start.sh is executable
|
| 35 |
RUN chmod +x start.sh
|
| 36 |
|
|
|
|
| 37 |
# Install Node dependencies
|
|
|
|
| 38 |
RUN npm install
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
-
#
|
|
|
|
|
|
|
| 43 |
CMD ["sh", "./start.sh"]
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1.4
|
| 2 |
FROM node:20-slim
|
| 3 |
|
| 4 |
+
# -----------------------------
|
| 5 |
+
# Install system dependencies
|
| 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 |
# Install Git LFS
|
| 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 /tmp && \
|
| 16 |
mv /tmp/git-lfs-3.4.0/git-lfs /usr/local/bin/git-lfs && \
|
| 17 |
chmod +x /usr/local/bin/git-lfs && \
|
| 18 |
git lfs install
|
| 19 |
|
| 20 |
+
# -----------------------------
|
| 21 |
+
# Working directory
|
| 22 |
+
# -----------------------------
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
+
# Clean /app in case something exists
|
| 26 |
RUN rm -rf /app/* || true
|
| 27 |
|
| 28 |
+
# -----------------------------
|
| 29 |
+
# Clone private repo and pull LFS in one secret-mounted layer
|
| 30 |
+
# -----------------------------
|
| 31 |
RUN --mount=type=secret,id=GH_TOKEN \
|
| 32 |
git clone --depth=1 https://$(cat /run/secrets/GH_TOKEN)@github.com/IMaduwike/telebot-api.git . && \
|
| 33 |
+
rm -rf .git && \
|
| 34 |
+
git lfs pull
|
| 35 |
|
| 36 |
+
# -----------------------------
|
| 37 |
+
# Move binary and make executable
|
| 38 |
+
# -----------------------------
|
|
|
|
|
|
|
|
|
|
| 39 |
RUN mv telegram-bot-api /usr/local/bin/telegram-bot-api && chmod +x /usr/local/bin/telegram-bot-api
|
| 40 |
|
|
|
|
|
|
|
| 41 |
# Make sure start.sh is executable
|
| 42 |
RUN chmod +x start.sh
|
| 43 |
|
| 44 |
+
# -----------------------------
|
| 45 |
# Install Node dependencies
|
| 46 |
+
# -----------------------------
|
| 47 |
RUN npm install
|
| 48 |
|
| 49 |
+
# -----------------------------
|
| 50 |
+
# Expose port for the proxy server
|
| 51 |
+
# -----------------------------
|
| 52 |
EXPOSE 7860
|
| 53 |
|
| 54 |
+
# -----------------------------
|
| 55 |
+
# Start the bot via shell
|
| 56 |
+
# -----------------------------
|
| 57 |
CMD ["sh", "./start.sh"]
|