Init Commit
This commit is contained in:
32
dockerfile
Normal file
32
dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Use the official Node.js image as the base image
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json (or yarn.lock)
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Build the Nuxt application
|
||||
RUN npm run build
|
||||
|
||||
# Use a smaller image for the final stage
|
||||
FROM node:20-alpine AS runner
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only the necessary files from the builder stage
|
||||
COPY --from=builder /app/.output /app/.output
|
||||
|
||||
# Expose the port Nuxt runs on (default is 3000)
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the Nuxt server
|
||||
CMD ["node", "/app/.output/server/index.mjs"]
|
Reference in New Issue
Block a user