caprover?!
This commit is contained in:
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# Use official Node.js image as base
|
||||
FROM node:18-alpine AS builder
|
||||
|
||||
# Set working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json first to leverage Docker cache
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install --frozen-lockfile
|
||||
|
||||
# Copy the rest of the application files
|
||||
COPY . .
|
||||
|
||||
# Build the Next.js application
|
||||
RUN npm run build
|
||||
|
||||
# ---- Production Stage ----
|
||||
FROM node:18-alpine AS runner
|
||||
|
||||
# Set working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only necessary files from builder
|
||||
COPY --from=builder /app/package.json /app/package-lock.json ./
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Expose port for Next.js
|
||||
EXPOSE 3000
|
||||
|
||||
# Set environment variable to indicate production mode
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Start Next.js server
|
||||
CMD ["npm", "run", "start"]
|
||||
7
captain-definition
Normal file
7
captain-definition
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"dockerfilePath": "./Dockerfile",
|
||||
"caproverExtra": {
|
||||
"containerHttpPort": "3001"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user