diff --git a/Dockerfile b/Dockerfile index 775012a0..da337cc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,39 @@ -FROM ubuntu:latest -MAINTAINER Shamal Faily +FROM debian:bookworm-slim +# Pin to Bookworm (Python 3.11). CAIRIS uses imghdr, which was removed in Python 3.13+. +LABEL maintainer="Shamal Faily " ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update -RUN apt-get install -y build-essential \ +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ python3-dev \ - mysql-client \ + default-mysql-client \ graphviz \ python3-pip \ python3-numpy \ python3-mysqldb \ git \ default-libmysqlclient-dev \ - python3-apt \ libxml2-dev \ libxslt1-dev \ libssl-dev \ + libmagic1 \ apache2 \ apache2-dev \ poppler-utils \ python3-setuptools \ - apt-transport-https \ - ca-certificates - -RUN pip3 install wheel --break-system-packages -#Installing Python modules -COPY docker/requirements.txt / -RUN pip3 install -r requirements.txt --break-system-packages -COPY docker/wsgi_requirements.txt / + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +COPY docker/requirements.txt docker/wsgi_requirements.txt / +RUN pip3 install wheel --break-system-packages \ + && pip3 install -r requirements.txt --break-system-packages RUN pip3 install -r wsgi_requirements.txt --break-system-packages -#Environment Variable starts from here -ENV CAIRIS_SRC=/cairis/cairis -ENV CAIRIS_CFG_DIR=/cairis/docker -ENV CAIRIS_CFG=/cairis.cnf -ENV PYTHONPATH=/cairis +ENV CAIRIS_SRC=/cairis/cairis \ + CAIRIS_CFG_DIR=/cairis/docker \ + CAIRIS_CFG=/cairis.cnf \ + PYTHONPATH=/cairis -RUN mkdir /tmpDocker -RUN mkdir /images +RUN mkdir /tmpDocker /images #Clonning the repo RUN git clone --depth 1 -b master https://github.com/cairis-platform/cairis /cairis @@ -47,17 +44,22 @@ RUN mkdir /cairisTmp &&\ rm -rf /cairis/ &&\ mv /cairisTmp/ /cairis/ -COPY docker/cairis.cnf / -COPY docker/setupDb.sh / -COPY docker/createdb.sql / -COPY docker/addAccount.sh / +COPY \ + docker/cairis.cnf \ + docker/setupDb.sh \ + docker/createdb.sql \ + docker/addAccount.sh \ + / +COPY cairis/bin/installUI.sh /cairis/cairis/bin/installUI.sh COPY docker/register_user.html /cairis/cairis/daemon/templates/security -RUN /cairis/cairis/bin/installUI.sh +RUN chmod +x /cairis/cairis/bin/installUI.sh \ + && /cairis/cairis/bin/installUI.sh -EXPOSE 8000 +RUN apt-get remove --purge -y git \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* -RUN apt-get remove --purge -y git -RUN apt-get autoremove -y +EXPOSE 8000 CMD ["./setupDb.sh"] diff --git a/cairis/bin/installUI.sh b/cairis/bin/installUI.sh index b99cb5d4..3e4c9581 100755 --- a/cairis/bin/installUI.sh +++ b/cairis/bin/installUI.sh @@ -1,4 +1,5 @@ -#!/bin/bash -x +#!/bin/bash +set -euo pipefail # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -13,20 +14,21 @@ # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the -# specific language go -# -# Author: Shamal Faily +# specific language governing permissions and limitations +# under the License. +# Author: Shamal Faily export UI_REPO=/tmp/cairis-ui -rm -rf $UI_REPO -apt-get install curl -curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list -apt-get update && apt-get install -y yarn -apt-get install -y yarn -git clone https://github.com/cairis-platform/cairis-ui $UI_REPO -yarn --cwd $UI_REPO install --ignore-engines -yarn --cwd $UI_REPO run build -cp -r $UI_REPO/dist $CAIRIS_SRC +rm -rf "$UI_REPO" + +apt-get update +apt-get install -y curl ca-certificates gnupg +curl -fsSL https://deb.nodesource.com/setup_16.x | bash - +apt-get install -y nodejs +npm install -g yarn + +git clone https://github.com/cairis-platform/cairis-ui "$UI_REPO" +yarn --cwd "$UI_REPO" install --ignore-engines +yarn --cwd "$UI_REPO" run build +cp -r "$UI_REPO/dist" "$CAIRIS_SRC"