This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chaz Leong <13462818+cleong14@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
125 additions
and
44 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,24 +1,77 @@ | ||
FROM node:alpine AS build | ||
ARG NODE_VERSION=18 | ||
ARG ALPINE_VERSION=3.18 | ||
|
||
FROM --platform=$TARGETPLATFORM artifactory.cloud.cms.gov/docker/library/node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS builder | ||
|
||
ARG NODE_VERSION | ||
ENV NODE_VERSION=${NODE_VERSION} | ||
|
||
ARG ALPINE_VERSION | ||
ENV ALPINE_VERSION=${ALPINE_VERSION} | ||
|
||
ARG TARGETPLATFORM | ||
ENV TARGETPLATFORM=${TARGETPLATFORM} | ||
|
||
# `docker build --build-arg ARG1="some ARG1 override" --build-arg ARG2="some ARG2 override"` | ||
ARG ARG1 | ||
ENV ARG1=${ARG1:-"default ARG1"} | ||
ARG ARG2 | ||
ENV ARG2=${ARG2:-"default ARG2"} | ||
|
||
WORKDIR /app | ||
COPY package.json . | ||
RUN npm install | ||
|
||
COPY angular.json \ | ||
eslint.config.js \ | ||
tsconfig.*.json \ | ||
lib \ | ||
spec \ | ||
src /app/ | ||
|
||
COPY package*.json . | ||
|
||
RUN npm ci && npm cache clean --force | ||
|
||
COPY package*.json . | ||
|
||
RUN npm ci && npm cache clean --force | ||
|
||
|
||
FROM builder AS build | ||
|
||
ARG NODE_VERSION | ||
ENV NODE_VERSION=${NODE_VERSION} | ||
|
||
ARG ALPINE_VERSION | ||
ENV ALPINE_VERSION=${ALPINE_VERSION} | ||
|
||
ARG TARGETPLATFORM | ||
ENV TARGETPLATFORM=${TARGETPLATFORM} | ||
|
||
# `docker build --build-arg ARG1="some ARG1 override" --build-arg ARG2="some ARG2 override"` | ||
ARG ARG1 | ||
ENV ARG1=${ARG1:-"default ARG1"} | ||
ARG ARG2 | ||
ENV ARG2=${ARG2:-"default ARG2"} | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
|
||
FROM node:alpine | ||
FROM --platform=$TARGETPLATFORM artifactory.cloud.cms.gov/docker/library/node:${NODE_VERSION}-alpine${ALPINE_VERSION} | ||
|
||
ARG NODE_VERSION | ||
ENV NODE_VERSION=${NODE_VERSION} | ||
|
||
ARG ALPINE_VERSION | ||
ENV ALPINE_VERSION=${ALPINE_VERSION} | ||
|
||
ARG TARGETPLATFORM | ||
ENV TARGETPLATFORM=${TARGETPLATFORM} | ||
|
||
# `docker build --build-arg ARG1="some ARG1 override" --build-arg ARG2="some ARG2 override"` | ||
ARG ARG1 | ||
ENV ARG1=${ARG1:-"default ARG1"} | ||
ARG ARG2 | ||
ENV ARG2=${ARG2:-"default ARG2"} | ||
|
||
WORKDIR /app | ||
COPY --from=build /app /app | ||
|
||
EXPOSE 4200 | ||
EXPOSE 8888 | ||
USER node | ||
|
||
COPY --chown=node:node --from=build /app /app | ||
|
||
CMD ["npm", "run", "start", "--", "--host", "0.0.0.0"] |
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