-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update dockerfile and package-lock
- Loading branch information
Showing
3 changed files
with
1,840 additions
and
1,731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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;"] |
Oops, something went wrong.