diff --git a/README.md b/README.md index 3c29d2d49b..3b13fbb06a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ make console ./console server ``` +# Run OpenMAXIO UI in docker: + [Docker Instructions](docker/). + # To connect OpenMaxIO UI to an existing Minio server run this command (replace 1.2.3.4:9000 to your address) ```bash diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000000..373c9ef890 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1 @@ +./certs/* diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..fef5e95258 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,46 @@ +FROM ubuntu:noble + +RUN mkdir -p /build + +WORKDIR /build + +RUN apt update +RUN apt install git -y +RUN apt install curl -y +RUN apt install wget -y +RUN apt-get install build-essential -y + + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash +RUN . /root/.nvm/nvm.sh ; nvm install 18 +RUN . /root/.nvm/nvm.sh ; nvm use 18 +RUN . /root/.nvm/nvm.sh ; corepack enable +RUN . /root/.nvm/nvm.sh ; corepack prepare yarn@4.4.0 --activate + +RUN wget https://go.dev/dl/go1.23.5.linux-amd64.tar.gz +RUN tar -C /usr/local/ -xzf go1.23.5.linux-amd64.tar.gz +RUN export PATH=$PATH:/usr/local/go/bin + + + + +RUN git clone https://github.com/OpenMaxIO/openmaxio-object-browser + +WORKDIR /build/openmaxio-object-browser/web-app/ + +RUN git checkout v1.7.6 + +RUN . /root/.nvm/nvm.sh ; yarn install +RUN . /root/.nvm/nvm.sh ; yarn build + +WORKDIR /build/openmaxio-object-browser +RUN export PATH=$PATH:/usr/local/go/bin ; make console + +FROM scratch +COPY --from=0 /build/openmaxio-object-browser/console /bin/console + + + +expose 9090 + +CMD [ "/bin/console", "server" ] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000..ad8d12edf5 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,28 @@ +# OpenMaxIO in docker + +### Prereqs +I assume this is being run on linux, if being run on windows you will need to generate certs diffirently + +### Configuration + +Set the location of minio: +docker-compose.yaml +- You need to set the "services/openmaxio/environment/CONSOLE_MINIO_SERVER" variable to your minio endpoint + +Use valid certs: +- If you want to use proper certs, place the cert and key in ./certs/minio.crt and ./certs/minio.key + +Set other environment variables: +- If you want to set further environment variables for minio, in docker-compose.yaml place them in "services/openmaxio/environment/" + + +### How to run + +``` + +cd docker +# if using the self-signed certs, run the following line, if using proper certs, skip it +./generate_certs.sh +docker compose up -d + +``` diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000000..f5696c4098 --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + openmaxio: + build: + context: . + dockerfile: Dockerfile + ports: + - "9090:9090" + environment: + - CONSOLE_MINIO_SERVER=http[s]://your_minio_instance:9000 + restart: unless-stopped + + nginx: + image: nginx:alpine + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./certs/minio.crt:/cert.crt:ro + - ./certs/minio.key:/cert.key:ro + depends_on: + - openmaxio + restart: unless-stopped diff --git a/docker/generate_certs.sh b/docker/generate_certs.sh new file mode 100644 index 0000000000..0660ab2585 --- /dev/null +++ b/docker/generate_certs.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +cd $SCRIPT_DIR + +mkdir -p certs + +openssl req -x509 -nodes -days 365 \ + -newkey rsa:2048 \ + -keyout certs/minio.key \ + -out certs/minio.crt \ + -subj "/CN=openmaxio" diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 0000000000..719ab82fec --- /dev/null +++ b/docker/nginx/nginx.conf @@ -0,0 +1,28 @@ +events {} + +http { + server { + listen 80; + return 301 https://$host$request_uri; + + + } + + server { + listen 443 ssl; + + client_max_body_size 100000M; + + ssl_certificate /cert.crt; + ssl_certificate_key /cert.key; + + location / { + proxy_pass http://openmaxio:9090; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } +}