- Created a Dockerfile with a multi-stage build process to containerize the application. - Added Makefile for managing build, export, and cleanup tasks.
32 lines
681 B
Docker
32 lines
681 B
Docker
# Stage 1: Build the application
|
|
FROM node:20-alpine AS build
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and yarn.lock
|
|
COPY package.json yarn.lock ./
|
|
|
|
# Install dependencies
|
|
RUN yarn install --frozen-lockfile
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN yarn build
|
|
|
|
# Stage 2: Serve the application with Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy the built application from the build stage
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx configuration (optional, can be added later if needed)
|
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start Nginx server
|
|
CMD ["nginx", "-g", "daemon off;"] |