1
0
portfolio-website/dockerfile
2025-02-26 15:40:10 -06:00

32 lines
712 B
Plaintext

# 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"]