Skip to content
Snippets Groups Projects
Dockerfile 601 B
Newer Older
  • Learn to ignore specific revisions
  • Daniel Göbel's avatar
    Daniel Göbel committed
    # build stage
    
    FROM node:22 AS build-stage
    
    Daniel Göbel's avatar
    Daniel Göbel committed
    WORKDIR /app
    COPY package.json ./
    COPY package-lock.json ./
    
    RUN npm install --no-fund
    
    RUN npm run build
    
    Daniel Göbel's avatar
    Daniel Göbel committed
    
    # production stage
    
    Daniel Göbel's avatar
    Daniel Göbel committed
    FROM nginx:stable-alpine AS production-stage
    
    HEALTHCHECK --interval=5s --timeout=2s CMD curl --head -f http://localhost || exit 1
    
    COPY nginx.conf /etc/nginx/conf.d/default.conf
    
    Daniel Göbel's avatar
    Daniel Göbel committed
    COPY --from=build-stage /app/dist /usr/share/nginx/html
    
    COPY --from=build-stage /app/src/assets/env.template.js /tmp
    
    CMD ["/bin/sh",  "-c",  "envsubst < /tmp/env.template.js > /usr/share/nginx/html/env.js && exec nginx -g 'daemon off;'"]