Created
June 29, 2024 07:10
-
-
Save alisafariir/44c8a1de8c91febb9ac35d32208d82d2 to your computer and use it in GitHub Desktop.
Angular SSR Dockerfile
This file contains hidden or 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
# Stage 1: Build the Angular application | |
FROM node:22.3.0-alpine AS build | |
WORKDIR /usr/src/app | |
# Copy package.json and package-lock.json | |
COPY package*.json ./ | |
# Install dependencies | |
RUN npm i | |
# Copy the entire application source code | |
COPY . . | |
# Build the Angular SSR application | |
RUN npm run build:ssr | |
# Stage 2: Create the final production image | |
FROM node:22.3.0-alpine | |
WORKDIR /usr/src/app | |
# Copy the built Angular SSR files from the previous stage | |
COPY --from=build /usr/src/app/dist ./dist | |
# Install only production dependencies | |
COPY package*.json ./ | |
RUN npm i | |
# Start the SSR server | |
CMD ["npm", "run", "serve:ssr"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment