diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..af1fa90f80c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +# syntax=docker/dockerfile:1 + +# Stage 1: Build the Rancher UI +FROM node:17-alpine as build-stage + +# Create the app directory +RUN mkdir -p /rancher-ui + +# Set the working directory +WORKDIR /rancher-ui + +# Copy the package.json and yarn.lock files +COPY package.json ./ +COPY yarn.lock ./ + +# Copy the source code +COPY pkg ./pkg +COPY shell ./shell + +# Copy the configuration files +COPY .eslint* ./ +COPY babel.config.js ./ +COPY svgTransform.js ./ +COPY tsconfig.json tsconfig.paths.json ./ +COPY vue-shim.d.ts vue.config.js ./ + +# Install the dependencies +RUN yarn install + +ENV ROUTER_BASE="/dashboard/" \ + RESOURCE_BASE="/dashboard/" + +# Build the Rancher UI +# Make sure we use the proper SSL provider +RUN NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096" \ + ./node_modules/.bin/vue-cli-service build --mode production + +# https://github.com/rancher/dashboard/blob/master/docs/developer/build-methods/build-for-container-registry.md +FROM rancher/rancher:v2.8-head +WORKDIR /var/lib/rancher + +RUN rm -rf /usr/share/rancher-ui/ui-dashboard/dashboard* +COPY --from=build-stage /rancher-ui/dist /usr/share/rancher/ui-dashboard/dashboard + +ENV CATTLE_UI_OFFLINE_PREFERRED=true \ + CATTLE_UI_DASHBOARD_INDEX="https://localhost/dashboard/index.html" diff --git a/README-tensorwave.md b/README-tensorwave.md new file mode 100644 index 00000000000..0acbb129233 --- /dev/null +++ b/README-tensorwave.md @@ -0,0 +1,50 @@ +## Installation + +You will need to install the following packages: +```sh +yarn add --dev @vue/cli-plugin-babel +yarn add --dev @babel/plugin-proposal-class-properties +``` + +## Development + +I'm not sure which version of Node is actually required but... to get the development service up and running you will need to set the following Node option: +```sh +set NODE_OPTIONS=--openssl-legacy-provider +``` + +The following line should bring up a development environment. ***NOTE***: The `API` option MUST point to a running Rancher API instance: +```sh +NODE_OPTIONS=--openssl-legacy-provider API=https://rancher.18.236.138.233.sslip.io yarn dev +``` + +## Deployment to Docker (local) + +Run docker compose on the docker-compose.yml file found in the base of this repository: +```sh +docker-compose up -d -f ./docker-compose.yml +``` + +## Deployment to Kubernetes + +1. Add the [Rancher Helm Chart] repository: +```sh +helm repo add rancher-stable https://releases.rancher.com/server-charts/stable +``` + +2. Install the [Rancher Helm Chart] you should use something similar to the following command: +```sh +helm install rancher rancher-latest/rancher \ + --namespace cattle-system \ + --set ingress.tls.source=letsEncrypt \ + --set hostname= \ + --set bootstrapPassword= \ + --set rancherImage=scull7/tensorwave-rancher \ + --set rancherImageTag=latest +``` +NOTE: The 2 most important options here are `rancherImage` and `rancherImageTag`. +These options are used to specify the image that will be used to run the Rancher server. +The `rancherImage` option should be set to the image that you want to use (i.e. the Tensorwave Version) and +the `rancherImageTag` option should be set to the tag of the image that you want to use (i.e. `latest`). + +[Rancher Helm Chart]: https://artifacthub.io/packages/helm/rancher-stable/rancher diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000000..b51e8f44102 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + dashboard: + image: scull7/tensorwave-rancher:latest + # image: scull7/tensorwave-rancher:v1-arm64 # for arm64 / Mac M1 + container_name: dashboard + restart: unless-stopped + privileged: true + volumes: + - rancher_data:/var/lib/rancher + ports: + - "80:80" + - "443:443" + environment: + - CATTLE_UI_DASHBOARD_INDEX=https://localhost/dashboard/index.html + - CATTLE_UI_OFFLINE_PREFERRED=true +volumes: + rancher_data: + driver: local