Skip to content
Snippets Groups Projects
Dockerfile 924 B
Newer Older
  • Learn to ignore specific revisions
  • # Stage 0, based on Node.js, to build and compile Angular
    
    Matthieu BENOIST's avatar
    Matthieu BENOIST committed
    FROM node:14.21.1 as builder
    
    
    # Copy the package.json file first in order to cache the modules
    COPY ./package.json /app/package.json
    
    COPY ./package-lock.json /app/package-lock.json
    
    WORKDIR /app
    # Install npm dependencies
    RUN npm install
    # Copy the project
    
    COPY tsconfig.json /app
    COPY angular.json /app
    COPY patch.js /app
    COPY src /app/src
    
    RUN ls /app
    
    
    # Launch postinstall script (to include crypto module)
    RUN npm run postinstall
    
    
    # Building the Angular app /dist
    
    RUN npm run build:${conf}
    
    
    # Stage 1, based on Nginx, to have only the compiled app
    FROM nginx
    
    
    ## Install dependency to get lua module in .conf
    RUN apt-get update
    
    RUN apt-get --assume-yes install nginx-extras
    
    RUN rm /etc/nginx/conf.d/*
    
    COPY --from=builder /app/dist/admin-gui /usr/share/nginx/html/admin
    
    RUN ls -l /usr/share/nginx/html
    EXPOSE 80
    
    CMD ["nginx", "-g", "daemon off;"]