Skip to content

Commit

Permalink
feat: update dockerfile and package-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
egenerse committed Jan 14, 2025
1 parent f50fedf commit 32726a9
Show file tree
Hide file tree
Showing 3 changed files with 1,840 additions and 1,731 deletions.
40 changes: 18 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
# Stage 1: Install dependencies and build the frontend
FROM node:20-alpine AS build
# Stage 1: Builder
FROM node:20.18.0-slim AS builder

# Set working directory
# Create and set working directory
WORKDIR /app

# Copy root package.json
COPY package.json ./
# Copy root-level package and lock files
COPY package*.json ./
# Copy workspace package files (if needed)
COPY library/package*.json ./library/
COPY standalone/webapp/package*.json ./standalone/webapp/
COPY standalone/server/package*.json ./standalone/server/

# Copy workspace package.json files
COPY library/package.json ./library/
COPY standalone/server/package.json ./standalone/server/
COPY standalone/webapp/package.json ./standalone/webapp/

# Install all dependencies (leveraging npm workspaces)
# Install all dependencies for the entire monorepo using npm ci
RUN npm install

# Copy the entire monorepo
# Copy all source code into the image
COPY . .

# Build the application
# Build the webapp - assuming there's a script at the root or
# you can directly run:
RUN npm run build

# Stage 2: Serve the built frontend with Nginx
# Stage 2: Production image
FROM nginx:alpine

# Remove default Nginx static assets
# Remove default nginx pages
RUN rm -rf /usr/share/nginx/html/*

# Copy built frontend from the previous stage
COPY --from=build /app/standalone/webapp/dist /usr/share/nginx/html

# Optional: Copy custom Nginx configuration
# COPY nginx.conf /etc/nginx/nginx.conf
# Copy the built webapp from the builder stage
COPY --from=builder /app/standalone/webapp/dist /usr/share/nginx/html

# Expose port 80
EXPOSE 80

# Start Nginx server
# Default command to run nginx
CMD ["nginx", "-g", "daemon off;"]
Loading

0 comments on commit 32726a9

Please sign in to comment.