dashboard-nanobot/frontend/Dockerfile

31 lines
656 B
Docker

ARG NODE_BASE_IMAGE=node:20-alpine
ARG NGINX_BASE_IMAGE=nginx:alpine
FROM ${NODE_BASE_IMAGE} AS build
WORKDIR /app
ARG NPM_REGISTRY=https://registry.npmjs.org/
COPY package.json yarn.lock ./
RUN corepack enable \
&& yarn config set registry "${NPM_REGISTRY}" \
&& yarn install --frozen-lockfile --network-timeout 120000
COPY . .
ARG VITE_API_BASE=/api
ARG VITE_WS_BASE=/ws/monitor
ENV VITE_API_BASE=${VITE_API_BASE}
ENV VITE_WS_BASE=${VITE_WS_BASE}
RUN yarn build
FROM ${NGINX_BASE_IMAGE}
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]