test this

This commit is contained in:
2025-06-17 19:16:56 +02:00
parent 2dd714bdd2
commit 7d4e5b226f
6 changed files with 20 additions and 399 deletions

View File

@@ -1,57 +1,23 @@
# Build stage
FROM node:18-alpine AS builder
# Use the official Node.js image as the base image
FROM node:14
# Set working directory
# Set the working directory
WORKDIR /app
# Copy package files
# Copy package.json and package-lock.json
COPY package*.json ./
# First install only production dependencies
RUN npm install --omit=dev
# Install dependencies
RUN npm install
# Copy source code and config files
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:18-alpine AS runner
# Set working directory
WORKDIR /app
# Copy package files
COPY --from=builder /app/package*.json ./
# Install production dependencies only
RUN npm install --omit=dev
# Copy necessary files from builder
COPY --from=builder /app/.next ./.next/
COPY --from=builder /app/public ./public/
COPY --from=builder /app/next.config.js ./
# Create a directory for markdown files
RUN mkdir -p /markdown
# Set environment variables
ENV NODE_ENV=production
ENV PORT=8080
ENV HOSTNAME=0.0.0.0
# Expose the port
# Expose the port the app runs on
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
# Start the application
CMD ["npm", "start"]
# Do NOT copy posts/admin.json or posts/admin.json.tmp into the image
# These files are excluded via .dockerignore for security
# In production, mount the posts directory as a volume to persist posts and admin password
# If posts/admin.json does not exist, the default admin password is 'admin' (see README)
CMD ["npm", "start"]