Create Dockerfile
Browse files- Dockerfile +39 -0
Dockerfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:24-alpine
|
| 2 |
+
|
| 3 |
+
###############################################################################
|
| 4 |
+
# 1. Install only necessary packages
|
| 5 |
+
###############################################################################
|
| 6 |
+
RUN apk add --no-cache \
|
| 7 |
+
git \
|
| 8 |
+
bash \
|
| 9 |
+
build-base \
|
| 10 |
+
curl \
|
| 11 |
+
wget \
|
| 12 |
+
unzip \
|
| 13 |
+
ca-certificates
|
| 14 |
+
|
| 15 |
+
###############################################################################
|
| 16 |
+
# 2. Startup script (clone repo at run-time)
|
| 17 |
+
###############################################################################
|
| 18 |
+
COPY <<'start.sh' /usr/local/bin/start.sh
|
| 19 |
+
#!/usr/bin/env bash
|
| 20 |
+
set -e
|
| 21 |
+
|
| 22 |
+
echo "Cloning $REPO …"
|
| 23 |
+
git clone --depth 1 "$REPO" /tmp/app
|
| 24 |
+
cd /tmp/app
|
| 25 |
+
|
| 26 |
+
# Install dependencies without devDependencies
|
| 27 |
+
npm install --omit=dev
|
| 28 |
+
|
| 29 |
+
chmod -R 777 /tmp/app
|
| 30 |
+
|
| 31 |
+
exec npm start
|
| 32 |
+
start.sh
|
| 33 |
+
RUN chmod +x /usr/local/bin/start.sh
|
| 34 |
+
|
| 35 |
+
###############################################################################
|
| 36 |
+
# 3. Container metadata
|
| 37 |
+
###############################################################################
|
| 38 |
+
EXPOSE 7860
|
| 39 |
+
CMD ["/usr/local/bin/start.sh"]
|