From 8ff3fdd549b047a1c1edeafd97ecd6b1500479b3 Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Wed, 3 Apr 2024 22:56:08 +0200 Subject: [PATCH] feat: update Dockerfile to use nginx --- Dockerfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9d7426..db230f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM --platform=linux/amd64 node:lts +# Stage 1: Build the application +FROM node:lts AS builder -RUN npm install -g http-server RUN npm install -g pnpm WORKDIR /app @@ -13,5 +13,12 @@ COPY . . RUN pnpm run build -EXPOSE 8080 -CMD [ "http-server", "dist" ] +# Stage 2: Serve the application using Nginx +FROM nginx:stable-alpine + +# Copy build artifacts from the builder stage +COPY --from=builder /app/dist /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"]