WIP
This commit is contained in:
parent
d28cce3fba
commit
2ec2f61904
7 changed files with 6533 additions and 2 deletions
0
BUN.md
Normal file
0
BUN.md
Normal file
|
|
@ -1,4 +1,4 @@
|
||||||
FROM --platform=linux/amd64 oven/bun:1.0.1
|
FROM --platform=linux/amd64 oven/bun:1.0.4
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
@ -16,6 +16,7 @@ RUN apt-get update && \
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN bun install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
RUN bunx --bun prisma generate
|
||||||
RUN bun --bun run build
|
RUN bun --bun run build
|
||||||
|
|
||||||
CMD ["bun", "run", "/app/.next/standalone/server.js"]
|
CMD ["bun", "run", "/app/.next/standalone/server.js"]
|
||||||
|
|
|
||||||
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
74
multistage.dockerfile
Normal file
74
multistage.dockerfile
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
FROM --platform=linux/amd64 node:18-bullseye-slim as node
|
||||||
|
FROM --platform=linux/amd64 oven/bun:1.0.1 as bun
|
||||||
|
|
||||||
|
### DEPENDENCIES
|
||||||
|
|
||||||
|
FROM node AS deps
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# RUN apk add --no-cache libc6-compat openssl1.1-compat
|
||||||
|
RUN apt-get update && apt-get install -y openssl=1.1.1n-0+deb11u5
|
||||||
|
|
||||||
|
COPY prisma ./prisma
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
RUN npm ci --frozen-lockfile
|
||||||
|
|
||||||
|
### BUILDER
|
||||||
|
|
||||||
|
FROM node AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=deps /app/prisma ./prisma
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
|
RUN SKIP_ENV_VALIDATION=1 npm run build
|
||||||
|
|
||||||
|
### RUNNER
|
||||||
|
|
||||||
|
# FROM base AS runner
|
||||||
|
|
||||||
|
FROM bun AS runner
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=production \
|
||||||
|
NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y ca-certificates openssl=1.1.1n-0+deb11u5 && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Required for `npx prisma migrate deploy`
|
||||||
|
COPY --from=builder /app/prisma ./prisma
|
||||||
|
|
||||||
|
# Required for `npx prisma db seed`
|
||||||
|
COPY --from=builder /app/content ./content
|
||||||
|
COPY --from=builder /app/src/content/training.ts ./src/content/training.ts
|
||||||
|
COPY --from=builder /app/src/server/db.ts ./src/server/db.ts
|
||||||
|
COPY --from=builder /app/src/env.mjs ./src/env.mjs
|
||||||
|
|
||||||
|
# Required for Next.js
|
||||||
|
COPY --from=builder /app/next.config.mjs ./
|
||||||
|
COPY --from=builder /app/tsconfig.json ./
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
USER nextjs
|
||||||
|
EXPOSE 3000
|
||||||
|
ENV PORT 3000
|
||||||
|
|
||||||
|
CMD ["bun", "run", "server.js"]
|
||||||
6446
package-lock.json
generated
Normal file
6446
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,6 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"postinstall": "prisma generate",
|
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"seed": "esbuild prisma/seed.ts --outfile=seed.cjs --bundle --format=cjs --external:prisma --external:@prisma/client --platform=node && node seed.cjs"
|
"seed": "esbuild prisma/seed.ts --outfile=seed.cjs --bundle --format=cjs --external:prisma --external:@prisma/client --platform=node && node seed.cjs"
|
||||||
|
|
|
||||||
11
scripts/create-image-pull-secret.sh
Executable file
11
scripts/create-image-pull-secret.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
USERNAME="FILL_ME"
|
||||||
|
PASSWORD="FILL_ME"
|
||||||
|
NAMESPACE="backoffice-staging"
|
||||||
|
|
||||||
|
kubectl create secret docker-registry registry \
|
||||||
|
--namespace $NAMESPACE \
|
||||||
|
--docker-server=registry.mareshq.com \
|
||||||
|
--docker-username=$USERNAME \
|
||||||
|
--docker-password=$PASSWORD
|
||||||
Reference in a new issue