fix: switch from npm ci to npm install in Dockerfile
All checks were successful
Deploy Portfolio to VPS / deploy (push) Successful in 25s
All checks were successful
Deploy Portfolio to VPS / deploy (push) Successful in 25s
This commit is contained in:
parent
3ff0eec28a
commit
04a053f813
1 changed files with 7 additions and 7 deletions
14
Dockerfile
14
Dockerfile
|
|
@ -1,33 +1,33 @@
|
||||||
# 1. Dependencies installieren
|
# 1. Install dependencies
|
||||||
FROM node:20-alpine AS deps
|
FROM node:20-alpine AS deps
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm install
|
||||||
|
|
||||||
# 2. Anwendung bauen
|
# 2. Build the application
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# 3. Production Image ausführen (Node.js Server)
|
# 3. Run production image (Node.js server)
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|
||||||
# Systemnutzer anlegen für mehr Sicherheit
|
# Create a system user for enhanced security
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
# Public & Standalone Build kopieren
|
# Copy public assets and standalone build output
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
# Ordner für Analytics-Daten anlegen und Schreibrechte vergeben
|
# Create analytics data directory and assign proper permissions
|
||||||
RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data
|
RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue