diff --git a/backend/Dockerfile b/backend/Dockerfile index 2553c26..f19eaa9 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,32 +1,38 @@ -FROM bitnami/minideb:buster - -# Install dependencies -RUN install_packages git python python-pip python-setuptools python-dev build-essential wget gnupg2 -RUN pip install python-dateutil +FROM ubuntu:noble +# # Install dependencies +RUN apt-get update && \ + apt-get install -y git python3 python3-pip python3-dev build-essential wget python3-dateutil python3.12-venv # Install Node.js / nodemon -RUN wget --no-check-certificate -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/node-8.9.3-0-linux-x64-debian-8.tar.gz && \ - tar -zxf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz -P --transform 's|^.*/files|/opt/bitnami|' --wildcards '*/files' && \ - rm -rf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz -ENV PATH="/opt/bitnami/node/bin:$PATH" -RUN npm install -g nodemon - -# Install mongo shell -RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - \ - && echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list \ - && apt-get update -y \ - && apt-get install -y mongodb-org-shell +RUN apt-get update && apt-get install -y curl && \ + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \ + export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ + nvm install 16 && \ + nvm alias default 16 && \ + npm install -g nodemon + +# # Install mongo shell +RUN apt-get update && \ + apt-get install -y gnupg curl && \ + curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \ + gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ + --dearmor && \ + echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-8.0.list && \ + apt-get update && \ + apt-get install -y mongodb-org # Configuration -RUN mkdir -p /etc/kernelci -COPY app/kernelci-backend.cfg /etc/kernelci/kernelci-backend.cfg +RUN mkdir -p /etc/linaro +COPY app/kernelci-backend.cfg /etc/linaro/kernelci-backend.cfg # Get source code COPY kernelci-backend /srv/kernelci-backend -# Install python dependencies -RUN install_packages libyaml-dev # needed for yaml.CLoader -RUN pip install -r /srv/kernelci-backend/requirements.txt +RUN python3 -m venv /venv && \ + /venv/bin/pip install --upgrade pip && \ + /venv/bin/pip install -r /srv/kernelci-backend/requirements.txt + EXPOSE 8888 diff --git a/backend/Dockerfile-celery b/backend/Dockerfile-celery index 0d2a86d..fff1893 100644 --- a/backend/Dockerfile-celery +++ b/backend/Dockerfile-celery @@ -1,31 +1,41 @@ -FROM bitnami/minideb:buster +FROM python:3.8 -# Install dependencies -RUN install_packages git python python-pip python-setuptools python-dev build-essential wget gnupg2 +# Install Node.js / nodemon +RUN apt-get update && apt-get install -y curl && \ + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \ + export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ + nvm install 16 && \ + nvm alias default 16 && \ + npm install -g nodemon + +# ENV PATH="/opt/nodejs/bin:$PATH" + +# RUN npm install -g nodemon + +# Use non root user +RUN groupadd user && useradd --create-home --home-dir /home/user -g user user # Configuration -COPY celery/celery-config.cfg /etc/kernelci/kernelci-celery.cfg -COPY app/kernelci-backend.cfg /etc/kernelci/kernelci-backend.cfg +COPY celery/celery-config.cfg /etc/linaro/kernelci-celery.cfg # Logs folder RUN mkdir -p /var/www/images/kernel-ci -# Copy backend source code -COPY kernelci-backend /srv/kernelci-backend +# Give additional rights on /var/www +RUN chown -R user:user /etc/linaro /var/www + +# Copy backend source code and give rigth to user +COPY kernelci-backend /home/user/kernelci-backend +RUN chown -R user:user /home/user/kernelci-backend # Install python dependencies -RUN install_packages libyaml-dev # needed for yaml.CLoader -RUN pip install -r /srv/kernelci-backend/requirements.txt + +RUN pip install -v -r /home/user/kernelci-backend/requirements.txt # Dedicated entrypoint COPY celery/entrypoint.sh /srv/entrypoint.sh -# kcidb (NOTE: requires python3) -RUN install_packages python3 python3-pip python3-setuptools python3-dev -RUN git clone -b v5 https://github.com/kernelci/kcidb.git /etc/kernelci/kcidb; \ - cd /etc/kernelci/kcidb; python3 -m pip install -r requirements.txt; \ - python3 -m pip install --upgrade google-cloud-pubsub; \ - python3 setup.py install - -# Run application +# Run application using newly created user +USER user CMD ["/srv/entrypoint.sh"] diff --git a/backend/kernelci-backend b/backend/kernelci-backend index 6111f84..85d6f41 160000 --- a/backend/kernelci-backend +++ b/backend/kernelci-backend @@ -1 +1 @@ -Subproject commit 6111f84cbffa57c1facf2119d65d3ee051bb5f86 +Subproject commit 85d6f4137049fb611736cd3c96de904747ed0202 diff --git a/docker-compose.yml b/docker-compose.yml index 4b47883..0b495c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: image: redis:3.2 restart: on-failure mongo: - image: mongo:4.2 + image: mongo:8.0 restart: on-failure volumes: - data:/data/db diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1b76151..438692d 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,27 +1,25 @@ -FROM bitnami/minideb:buster +FROM bitnami/minideb:bullseye # Install dependencies +RUN install_packages build-essential git python python3-pip python-dev uwsgi-plugin-python3 curl redis-tools wget -RUN install_packages build-essential git python python-pip python-setuptools python-dev uwsgi-plugin-python curl redis-tools wget - -# Install Node.js / nodemon -RUN wget --no-check-certificate -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/node-8.9.3-0-linux-x64-debian-8.tar.gz && \ - tar -zxf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz -P --transform 's|^.*/files|/opt/bitnami|' --wildcards '*/files' && \ - rm -rf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz -ENV PATH="/opt/bitnami/node/bin:$PATH" -RUN npm install -g nodemon +RUN apt-get update && apt-get install -y curl && \ + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \ + export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ + nvm install 16 && \ + nvm alias default 16 && \ + npm install -g nodemon # Setup application - WORKDIR /srv COPY kernelci-frontend /srv/kernelci-frontend -RUN pip install -r kernelci-frontend/requirements.txt +RUN pip install -r /srv/kernelci-frontend/requirements.txt WORKDIR /srv/kernelci-frontend/app RUN touch /etc/flask_settings -COPY flask_settings /etc/kernelci/kernelci-frontend.cfg +COPY flask_settings /etc/linaro/kernelci-frontend.cfg # uWSGI configuration - EXPOSE 5000 COPY uwsgi.ini /srv/uwsgi.ini COPY entrypoint.sh /srv/entrypoint.sh diff --git a/frontend/kernelci-frontend b/frontend/kernelci-frontend index 459fafa..1bba97a 160000 --- a/frontend/kernelci-frontend +++ b/frontend/kernelci-frontend @@ -1 +1 @@ -Subproject commit 459fafaadc261f3c0cf73f77e9ab3d984db1bf89 +Subproject commit 1bba97a22ae17e0e6114ef1e1b24ae2e0e56f750 diff --git a/proxy/Dockerfile b/proxy/Dockerfile index 93549c3..e3f13a7 100644 --- a/proxy/Dockerfile +++ b/proxy/Dockerfile @@ -3,15 +3,15 @@ FROM mhart/alpine-node:6.11.3 as frontend RUN apk update && apk add git rsync -RUN git clone https://github.com/kernelci/kernelci-frontend.git front +RUN git clone https://github.com/krrish-sehgal/kernelci-frontend.git front RUN node /front/app/dashboard/static/js/lib/r.js -o /front/app/dashboard/static/js/build.js # API documentation -FROM bitnami/minideb:buster as backend +FROM ubuntu:noble as backend RUN install_packages git python python-pip python-setuptools python-dev build-essential -RUN git clone https://github.com/kernelci/kernelci-backend.git /tmp/kernelci-backend +RUN git clone https://github.com/krrish-sehgal/kernelci-backend.git /tmp/kernelci-backend RUN pip install -r /tmp/kernelci-backend/requirements.txt RUN cd /tmp/kernelci-backend/doc && make html diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index b86b2f5..fbbac7c 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -6,7 +6,7 @@ # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| - config.vm.box = "debian/jessie64" + config.vm.box = "debian/bullseye64" # config.vm.network "forwarded_port", guest: 8080, host: 8080 # config.vm.network "forwarded_port", guest: 8081, host: 8081