Skip to content
Snippets Groups Projects
Dockerfile 797 B
Newer Older
  • Learn to ignore specific revisions
  • # Stage 0, based on Node.js, to build and compile Angular
    ARG DEPENDENCY_PROXY=
    FROM ${DEPENDENCY_PROXY}node:18.17-slim AS build
    
    WORKDIR /app
    
    # Copy the package.json file first in order to cache the modules
    COPY ./package.json .
    COPY ./package-lock.json .
    
    # Install npm dependencies
    RUN npm install --silent
    
    # Copy the project
    COPY angular.json .
    COPY tsconfig.json .
    COPY tsconfig.app.json .
    COPY src/ ./src/
    COPY .storybook/ ./.storybook/
    
    # Building the storybook static app
    RUN npm run build-storybook
    
    # Stage 1, based on Nginx, to have only the compiled app
    FROM ${DEPENDENCY_PROXY}nginxinc/nginx-unprivileged:1.25
    
    # copy storybook static app
    COPY --from=build /app/storybook-static /usr/share/nginx/html/
    
    # expose port 8080
    EXPOSE 8080
    
    # run nginx
    CMD ["nginx", "-g", "daemon off;"]