Skip to content

Instantly share code, notes, and snippets.

@ndamulelonemakh
Created May 23, 2024 21:28
Show Gist options
  • Save ndamulelonemakh/b8cc570338363d11fc7bf7b68e2686e9 to your computer and use it in GitHub Desktop.
Save ndamulelonemakh/b8cc570338363d11fc7bf7b68e2686e9 to your computer and use it in GitHub Desktop.
Sample docker file for running angular 17+ with ssr support
FROM node:lts-alpine as build
WORKDIR /app
COPY package*.json ./
# Install dependencies
RUN npm ci --force
COPY . .
# Set environment for Angular CLI
ARG configuration=production
RUN npm run build:ssr --configuration $configuration
FROM node:lts-alpine as runtime
# Set working directory
WORKDIR /app
# Copy the built Angular app from the build stage
COPY --from=build /app/dist/your-app-name/browser /app/browser
COPY --from=build /app/dist/your-app-name/server /app/server
# Expose the port your Angular app will run on (default is 4000 for Angular Universal)
EXPOSE 4000
# Set environment for Angular Universal
ENV NODE_ENV=production
# Start the Angular Universal server
CMD ["node", "server/main.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment