35 lines
872 B
Docker
35 lines
872 B
Docker
ARG NODE_BASE_IMAGE=node:22-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 npm config set registry "${NPM_REGISTRY}" \
|
|
&& rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg \
|
|
&& npm install -g yarn@1.22.22 --registry "${NPM_REGISTRY}" \
|
|
&& 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.template
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["/entrypoint.sh"]
|