ARG DEPENDENCY_PROXY=
FROM ${DEPENDENCY_PROXY}node:18.17-slim AS builder


# Set build directory
WORKDIR /app

# Copy the package.json file first in order to cache the modules
COPY ./package.json .
COPY ./yarn.lock .

RUN yarn

# Copy the project
COPY tsconfig.json .
COPY sidebars.ts .
COPY docusaurus.config.ts .

COPY /src ./src
COPY /docs ./docs
COPY /static ./static

# build the documentation site
RUN yarn build

# Expose server port
FROM nginxinc/nginx-unprivileged:1.25

RUN rm -rf /etc/nginx/html/* 
COPY --from=builder /app/build /usr/share/nginx/html
RUN ls -l /usr/share/nginx/html
EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]