deploy-stack 0.17.2 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# ==========================================
|
|
2
|
+
# Stage 1: Builder
|
|
3
|
+
# ==========================================
|
|
4
|
+
FROM node:22-alpine AS builder
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
# Install all dependencies (including devDependencies)
|
|
8
|
+
COPY package*.json ./
|
|
9
|
+
RUN npm ci
|
|
10
|
+
|
|
11
|
+
# Copy source code
|
|
12
|
+
COPY . .
|
|
13
|
+
|
|
14
|
+
# ZERO-CLICK MAGIC: Automatically inject adapter-node if the user left adapter-auto in their config.
|
|
15
|
+
# This ensures the build/ directory is always generated without requiring manual code changes.
|
|
16
|
+
RUN npm install -D @sveltejs/adapter-node@latest && \
|
|
17
|
+
sed -i 's/@sveltejs\/adapter-auto/@sveltejs\/adapter-node/g' svelte.config.js 2>/dev/null || true && \
|
|
18
|
+
sed -i 's/@sveltejs\/adapter-auto/@sveltejs\/adapter-node/g' vite.config.ts 2>/dev/null || true && \
|
|
19
|
+
sed -i 's/@sveltejs\/adapter-auto/@sveltejs\/adapter-node/g' vite.config.js 2>/dev/null || true
|
|
20
|
+
|
|
21
|
+
# Inject the bypass flag and compile the SvelteKit application
|
|
22
|
+
RUN DEPLOY_STACK_BYPASS=true npm run build
|
|
23
|
+
|
|
24
|
+
# ==========================================
|
|
25
|
+
# Stage 2: Production (Zero-CVE)
|
|
26
|
+
# ==========================================
|
|
1
27
|
FROM node:22-alpine
|
|
2
28
|
|
|
3
29
|
# 1. DevSecOps: Patch underlying Alpine OS vulnerabilities
|
|
@@ -8,18 +34,17 @@ ENV NODE_ENV=production
|
|
|
8
34
|
WORKDIR /app
|
|
9
35
|
|
|
10
36
|
# 3. Copy manifests and install ONLY production dependencies
|
|
11
|
-
COPY --chown=node:node package*.json ./
|
|
37
|
+
COPY --from=builder --chown=node:node /app/package*.json ./
|
|
12
38
|
RUN npm ci --omit=dev && npm cache clean --force
|
|
13
39
|
|
|
14
|
-
# 4. Copy the compiled SvelteKit server
|
|
15
|
-
COPY --chown=node:node build/ ./build/
|
|
16
|
-
COPY --chown=node:node package.json ./
|
|
40
|
+
# 4. Copy the compiled SvelteKit server from the builder stage
|
|
41
|
+
COPY --from=builder --chown=node:node /app/build/ ./build/
|
|
17
42
|
|
|
18
|
-
# 5. DevSecOps:
|
|
43
|
+
# 5. DevSecOps: Nuke NPM completely to eliminate Trivy vulnerabilities
|
|
19
44
|
RUN rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx
|
|
20
45
|
|
|
21
46
|
USER node
|
|
22
47
|
EXPOSE {{PORT}}
|
|
23
48
|
|
|
24
|
-
# 6. Execute the raw Node server directly
|
|
49
|
+
# 6. Execute the raw Node server directly
|
|
25
50
|
CMD ["node", "build/index.js"]
|