From d6009b0f410e94755c94b2c88b2c7827b87974fc Mon Sep 17 00:00:00 2001 From: ITQ Date: Thu, 8 May 2025 12:50:28 +0300 Subject: [PATCH] chore: optimized docs image --- infrastructure/nginx/nginx.conf | 2 +- services/docs/Dockerfile | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/infrastructure/nginx/nginx.conf b/infrastructure/nginx/nginx.conf index 4185af8..d6035c7 100644 --- a/infrastructure/nginx/nginx.conf +++ b/infrastructure/nginx/nginx.conf @@ -108,7 +108,7 @@ http { } location /docs { - proxy_pass http://docs:3000; + proxy_pass http://docs:80; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; diff --git a/services/docs/Dockerfile b/services/docs/Dockerfile index ee2e828..fc225b5 100644 --- a/services/docs/Dockerfile +++ b/services/docs/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Base image -FROM node:lts AS base +FROM node:lts-alpine AS base ENV FORCE_COLOR=0 @@ -14,13 +14,15 @@ WORKDIR /opt/docusaurus COPY . /opt/docusaurus/ -RUN npm ci +RUN npm ci --omit=dev RUN npm run build -# Stage 3: Serve with docusaurus serve -FROM prod AS serve +# Stage 3: Serve with nginx +FROM nginx:stable-alpine AS serve -EXPOSE 3000 +COPY --from=builder /opt/docusaurus/build /usr/share/nginx/html -CMD ["npm", "run", "serve", "--", "--host", "0.0.0.0", "--no-open"] +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"]