From e7009dc214f9dfa42b5fdb5f669d8418fd78b24c Mon Sep 17 00:00:00 2001 From: dmcdowell Date: Tue, 22 Aug 2023 09:55:29 -0600 Subject: [PATCH] updated dockerfile --- Dockerfile | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 18d0205..0a64536 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,19 @@ -FROM node:latest as builder - +# ---- Base Node ---- +FROM node:14 AS base WORKDIR /app +# ---- Dependencies ---- +FROM base AS dependencies +COPY package*.json ./ +RUN npm ci COPY . . -RUN yarn install --frozen-lockfile -RUN yarn build +# ---- Build ---- +FROM dependencies AS build +RUN npm run build -FROM node:alpine - -WORKDIR /app - -COPY --from=builder /app/package.json /app/yarn.lock ./ -COPY --from=builder /app/build ./ - -RUN yarn install --frozen-lockfile --production - -RUN apk add curl -HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3\ - CMD [ "curl", "--fail", "--silent", "--output", "/dev/null", "localhost:3000/api/health" ] - -EXPOSE 3000 - -CMD ["node", "./index.js"] \ No newline at end of file +# --- Release with Nginx ---- +FROM nginx:1.16.0-alpine AS release +COPY --from=build /app/build /usr/share/nginx/html/ +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file