Migrated from bun to deno for deployment
This commit is contained in:
1 parent
be34ee2ce3
commit
825a99e769
7 files changed
+2979
-6055
No files matched your search
@@ -0,0 +1,20 @@
|
||||
# Dependencies and build outputs — installed/built inside the image
|
||||
node_modules
|
||||
.next
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Docker
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
|
||||
# Local env & editor files (never bake secrets into images)
|
||||
.env*
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Misc
|
||||
README.md
|
||||
*.log
|
||||
+31
-18
@@ -1,27 +1,40 @@
|
||||
FROM oven/bun:alpine AS base
|
||||
# ---------- Build stage ----------
|
||||
FROM denoland/deno:2.9.7 AS builder
|
||||
|
||||
# Step 1. Install dependencies
|
||||
FROM base AS deps
|
||||
ENV DENO_DIR=/deno-dir \
|
||||
DENO_NO_UPDATE_CHECK=1 \
|
||||
DENO_NO_PROMPT=1
|
||||
WORKDIR /app
|
||||
COPY package.json bun.lock* ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Step 2. Rebuild the source code
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY deno.json deno.lock package.json ./
|
||||
|
||||
RUN deno install --allow-scripts
|
||||
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
# Step 3. Production image
|
||||
FROM base AS runner
|
||||
RUN deno task build
|
||||
|
||||
|
||||
# ---------- Production stage ----------
|
||||
FROM denoland/deno:2.9.7
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
ENV NODE_ENV=production \
|
||||
PORT=3000 \
|
||||
HOSTNAME="0.0.0.0" \
|
||||
DENO_DIR=/deno-dir \
|
||||
DENO_NO_UPDATE_CHECK=1 \
|
||||
DENO_NO_PROMPT=1
|
||||
|
||||
RUN mkdir -p /home/deno && chown deno:deno /home/deno
|
||||
|
||||
COPY --chown=deno:deno deno.json ./
|
||||
|
||||
COPY --from=builder --chown=deno:deno /app/.next/standalone ./
|
||||
COPY --from=builder --chown=deno:deno /app/.next/static ./.next/static
|
||||
COPY --from=builder --chown=deno:deno /app/public ./public
|
||||
|
||||
USER deno
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
CMD ["bun", "server.js"]
|
||||
|
||||
CMD ["deno", "run", "-A", "--no-remote", "--unstable-detect-cjs", "server.js"]
|
||||
@@ -11,7 +11,7 @@ yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
deno task dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"unstable": [
|
||||
"detect-cjs",
|
||||
"node-globals",
|
||||
"unsafe-proto",
|
||||
"sloppy-imports"
|
||||
],
|
||||
"nodeModulesDir": "manual"
|
||||
}
|
||||
Generated
-6035
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -6,7 +6,8 @@
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
"lint": "eslint",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"clsx": "^2.1.1",
|
||||
|
||||
Reference in new issue
Block a user