From 27ff8f19c7dbfd276d4ed1234f0803fbf2344e99 Mon Sep 17 00:00:00 2001 From: Dome Date: Fri, 28 Mar 2025 16:23:19 +0100 Subject: [PATCH] Update Dockerfile --- Dockerfile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16400a7..dbf96be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,23 @@ -# Build +# Stage 1: Build FROM node:20.2-alpine AS build WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile +RUN yarn install COPY . . +RUN yarn build -# Expose port 5000 -EXPOSE 5000 +# Stage 2: Production +FROM nginx:alpine +WORKDIR /etc/nginx +COPY ./nginx.conf /etc/nginx/nginx.conf +WORKDIR /usr/share/nginx/html +COPY --from=build /app/build . -# Start -ENV PORT=5000 -CMD ["yarn", "start"] +# Expose port 80 +EXPOSE 80 + +# Healthcheck +HEALTHCHECK CMD curl --fail http://localhost:80 || exit 1 + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"]