refactor(api, ws, webhook): replace base image with node:20-alpine and streamline Dockerfiles for api, webhook, and ws services (#8385)

This commit is contained in:
Himanshu Garg
2025-06-02 11:03:30 +05:30
committed by GitHub
parent 6aa1079f87
commit faccedb48e
4 changed files with 39 additions and 17 deletions

View File

@@ -1,4 +1,16 @@
FROM ghcr.io/novuhq/novu/base:1.1.0 AS dev
FROM node:20-alpine3.19 AS dev_base
RUN apk add --no-cache g++ make py3-pip
ENV NX_DAEMON=false
# Install global dependencies
RUN npm --no-update-notifier --no-fund --global install pm2 pnpm@10.11.0&& \
pnpm --version
# Set non-root user
USER 1000
WORKDIR /usr/src/app
FROM dev_base AS dev
ARG PACKAGE_PATH
COPY --chown=1000:1000 ./meta .
@@ -35,7 +47,7 @@ WORKDIR /usr/src/app
RUN rm -rf node_modules && pnpm recursive exec -- rm -rf ./src ./node_modules
# ------- PRODUCTION BUILD ----------
FROM ghcr.io/novuhq/novu/base:1.1.0 AS prod
FROM dev_base AS prod
ARG PACKAGE_PATH

View File

@@ -1,5 +1,17 @@
# Use the base image for development
FROM ghcr.io/novuhq/novu/base:1.1.0 AS dev
FROM node:20-alpine3.19 AS dev_base
RUN apk add --no-cache g++ make py3-pip
ENV NX_DAEMON=false
# Install global dependencies
RUN npm --no-update-notifier --no-fund --global install pm2 pnpm@10.11.0&& \
pnpm --version
# Set non-root user
USER 1000
WORKDIR /usr/src/app
FROM dev_base AS dev
ARG PACKAGE_PATH
# Copy necessary directories to the image with appropriate ownership
@@ -31,7 +43,7 @@ RUN rm -rf node_modules && pnpm recursive exec -- rm -rf ./src ./node_modules
# ------- PRODUCTION BUILD ----------
# Use the base image for production
FROM ghcr.io/novuhq/novu/base:1.1.0 AS prod
FROM dev_base AS prod
ARG PACKAGE_PATH
# Set environment variables for production

View File

@@ -1,4 +1,14 @@
FROM ghcr.io/novuhq/novu/base:1.1.0
FROM node:20-alpine3.19 AS dev_base
RUN apk add --no-cache g++ make py3-pip
ENV NX_DAEMON=false
# Install global dependencies
RUN npm --no-update-notifier --no-fund --global install pm2 pnpm@10.11.0&& \
pnpm --version
# Set non-root user
USER 1000
WORKDIR /usr/src/app
COPY --chown=1000:1000 .npmrc .
COPY --chown=1000:1000 .npmrc-cloud .

View File

@@ -1,12 +0,0 @@
# Base Dockerfile to be published on GHCR
FROM node:20-alpine3.19
RUN apk add --no-cache g++ make py3-pip
ENV NX_DAEMON=false
# Install global dependencies
RUN npm --no-update-notifier --no-fund --global install pm2 pnpm@10.11.0 && \
pnpm --version
# Set non-root user
USER 1000
WORKDIR /usr/src/app