-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
# Stage 1: Build Stage | ||
FROM node:18.19.1-bookworm-slim AS build | ||
FROM node:18.19.1 AS build | ||
|
||
# Set environment variables for New Relic | ||
ENV NEW_RELIC_NO_CONFIG_FILE=true | ||
ENV NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true | ||
ENV NEW_RELIC_LOG=stdout | ||
|
||
# Create a directory for your app and set it as the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy specific files and directories required for the image to run | ||
COPY package.json . | ||
COPY package-lock.json . | ||
# Copy package.json and package-lock.json for dependency installation | ||
COPY package*.json ./ | ||
|
||
# Install app dependencies and update npm | ||
RUN npm install -g [email protected] | ||
# Install app dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code including views directory | ||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Stage 2: Production Stage | ||
FROM node:18.19.1-bookworm-slim | ||
FROM node:18.19.1 | ||
|
||
# Create a non-root user and group for running the application | ||
RUN groupadd -g 1001 nonroot && useradd -u 1001 -g nonroot -m nonroot | ||
|
||
# Create a directory for your app and set it as the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Set environment variables for New Relic | ||
ENV NEW_RELIC_NO_CONFIG_FILE=true | ||
ENV NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true | ||
ENV NEW_RELIC_LOG=stdout | ||
|