updated dockerfile for custom server.js file

This commit is contained in:
biersoeckli
2024-11-18 10:33:09 +00:00
parent a8cec77112
commit a24236ebd4
7 changed files with 90 additions and 10 deletions
+2 -1
View File
@@ -9,4 +9,5 @@ README.md
.git .git
db db
internal internal
shared shared
dist
+2 -1
View File
@@ -42,4 +42,5 @@ kube-config.config_clusteradmin
kube-config.config_old kube-config.config_old
kube-config.config_restricted kube-config.config_restricted
internal internal
shared shared
dist
+7 -7
View File
@@ -24,6 +24,7 @@ COPY . .
RUN yarn run prisma-generate-build RUN yarn run prisma-generate-build
RUN yarn run build RUN yarn run build
RUN rm -rf ./next/standalone
# Production image, copy all the files and run next # Production image, copy all the files and run next
FROM base AS runner FROM base AS runner
@@ -38,15 +39,14 @@ RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size # Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing # https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/dist ./dist
COPY --from=builder --chown=nextjs:nodejs /app/dist ./dist
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
USER nextjs USER nextjs
@@ -54,4 +54,4 @@ ENV PORT=3000
# server.js is created by next build from the standalone output # server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output # https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js CMD HOSTNAME="0.0.0.0" npm run start-prod
BIN
View File
Binary file not shown.
+3 -1
View File
@@ -5,8 +5,9 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"dev-live": "bun src/server.ts", "dev-live": "bun src/server.ts",
"build": "next build", "build": "next build && tsc --project tsconfig.server.json",
"start": "next start", "start": "next start",
"start-prod": "cross-env NODE_ENV=production node dist/server.js",
"prisma-generate": "bunx prisma generate && bun ./fix-wrong-zod-imports.js", "prisma-generate": "bunx prisma generate && bun ./fix-wrong-zod-imports.js",
"prisma-generate-build": "npx prisma generate && node ./fix-wrong-zod-imports.js", "prisma-generate-build": "npx prisma generate && node ./fix-wrong-zod-imports.js",
"prisma-migrate": "bunx prisma migrate dev --name migration", "prisma-migrate": "bunx prisma migrate dev --name migration",
@@ -38,6 +39,7 @@
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"cmdk": "1.0.0", "cmdk": "1.0.0",
"cross-env": "^7.0.3",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"date-fns-tz": "^3.2.0", "date-fns-tz": "^3.2.0",
"lucide-react": "^0.453.0", "lucide-react": "^0.453.0",
+59
View File
@@ -105,6 +105,65 @@ rm cluster-issuer.yaml
sudo kubectl get nodes sudo kubectl get nodes
# deploy QuickStack
cat <<EOF > quick-stack.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: quickstack-internal-pvc
namespace: quickstack
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: quickstack
namespace: quickstack
spec:
replicas: 1
selector:
matchLabels:
app: quickstack
template:
metadata:
labels:
app: quickstack
spec:
strategy:
type: Recreate
containers:
- name: quickstack-container
image: quickstack/quickstack:latest
imagePullPolicy: "Always"
volumeMounts:
- name: quickstack-internal-pvc
mountPath: /mnt/internal
volumes:
- name: quickstack-internal-pvc
persistentVolumeClaim:
claimName: quickstack-internal-pvc
---
apiVersion: v1
kind: Service
metadata:
name: quickstack-svc
namespace: quickstack
spec:
selector:
app: quickstack
ports:
- nodePort: 3000
protocol: TCP
port: 3000
targetPort: 3000
EOF
# evaluate url to add node to cluster # evaluate url to add node to cluster
joinTokenForOtherNodes=$(sudo cat /var/lib/rancher/k3s/server/node-token) joinTokenForOtherNodes=$(sudo cat /var/lib/rancher/k3s/server/node-token)
echo "To add a worker node to the cluster, run the following command on the worker node:" echo "To add a worker node to the cluster, run the following command on the worker node:"
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"moduleResolution": "node",
"module": "commonjs",
"outDir": "dist",
"lib": [
"ES2023"
],
"target": "ES2023",
"isolatedModules": false,
"noEmit": false
},
"include": [
"src/server.ts"
]
}