sft0farid commited on
Commit
8ef7f5e
Β·
verified Β·
1 Parent(s): cace07e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -10
Dockerfile CHANGED
@@ -1,18 +1,41 @@
1
- FROM node:20-slim
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  ENV NODE_ENV=production
4
  ENV PORT=7860
 
 
5
 
6
  WORKDIR /app
7
 
8
- # Clone Interstellar (Space repo contains only this Dockerfile)
9
- # Use --branch Ad-Free to get the version without ads
10
- RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
11
- && git clone --depth 1 --branch Ad-Free https://github.com/UseInterstellar/Interstellar . \
12
- && npm install --omit=dev \
13
- && apt-get purge -y git \
14
- && apt-get autoremove -y \
15
- && rm -rf /var/lib/apt/lists/* \
 
 
16
  && chown -R node:node /app
17
 
18
  # node user (UID 1000) already exists in node:20-slim
@@ -20,4 +43,4 @@ USER node
20
 
21
  EXPOSE 7860
22
 
23
- CMD ["node", "index.js"]
 
1
+ # ── Stage 1: build Astro frontend ─────────────────────────────────────────────
2
+ FROM node:20-slim AS builder
3
+
4
+ ENV PNPM_HOME="/pnpm"
5
+ ENV PATH="$PNPM_HOME:$PATH"
6
+
7
+ RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
8
+ && corepack enable \
9
+ && git clone --depth 1 https://github.com/Bolt-Network/Bolt-Unblocker /app \
10
+ && apt-get purge -y git \
11
+ && apt-get autoremove -y \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ WORKDIR /app
15
+
16
+ RUN pnpm install --frozen-lockfile
17
+ RUN pnpm build
18
+
19
+ # ── Stage 2: runtime ──────────────────────────────────────────────────────────
20
+ FROM node:20-slim AS runtime
21
 
22
  ENV NODE_ENV=production
23
  ENV PORT=7860
24
+ ENV PNPM_HOME="/pnpm"
25
+ ENV PATH="$PNPM_HOME:$PATH"
26
 
27
  WORKDIR /app
28
 
29
+ RUN corepack enable
30
+
31
+ # Copy built assets and source
32
+ COPY --from=builder /app/dist ./dist
33
+ COPY --from=builder /app/app.js ./app.js
34
+ COPY --from=builder /app/package.json ./package.json
35
+ COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
36
+
37
+ # Install only production deps
38
+ RUN pnpm install --frozen-lockfile --prod \
39
  && chown -R node:node /app
40
 
41
  # node user (UID 1000) already exists in node:20-slim
 
43
 
44
  EXPOSE 7860
45
 
46
+ CMD ["node", "app.js"]