diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..261ff81 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:22.04 + +RUN apt-get -y update && \ + apt-get install -y sudo python3 python3-pip \ + gcc git python3-dev libssl-dev libffi-dev \ + python3-lxml apache2 libapache2-mod-wsgi-py3 \ + mariadb-server python3-pymysql vim nano wget + +RUN sudo pip3 install cffi cryptography Flask \ + launchpadlib simplejson requests pytest \ + python-dotenv + +ADD --keep-git-dir=true https://github.com/openmainframeproject/software-discovery-tool.git /opt/software-discovery-tool + +WORKDIR /opt/software-discovery-tool + +RUN git submodule update --init --recursive --remote + +RUN mv src/config/supported_distros.py.example src/config/supported_distros.py && \ + mv .env.example .env + +RUN git fetch && git checkout remotes/origin/data-update-fixes +RUN bash -c "echo 'export PYTHONPATH=/opt/software-discovery-tool/src/classes:/opt/software-discovery-tool/src/config:$PYTHONPATH' > /etc/profile.d/software-discovery-tool.sh" + +RUN cp -f /opt/software-discovery-tool/src/config/sdt.conf /etc/apache2/sites-available/sdt.conf && \ + mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/z-000-default.conf + +RUN useradd -s /usr/bin/bash apache && \ + chown -R apache:apache /opt/software-discovery-tool/ + +RUN a2dissite 000-default.conf && \ + a2ensite sdt.conf + +RUN apachectl restart + +#USER apache diff --git a/bin/build.sh b/bin/build.sh new file mode 100644 index 0000000..f97bcc6 --- /dev/null +++ b/bin/build.sh @@ -0,0 +1,8 @@ +# check if every .example is renamed to original +# warn db hostname is localhost +#check if root password in env file has changed or not +# print if there are previous images in the system for sdt +# add instruction how to remove them +# docker build +# prep mariadb +# docker run diff --git a/src/setup/Dockerfile b/src/setup/Dockerfile deleted file mode 100644 index 6c33d9d..0000000 --- a/src/setup/Dockerfile +++ /dev/null @@ -1,98 +0,0 @@ -################# Dockerfile for software-discovery-tool ##################### -# -# This Dockerfile builds a basic installation of software-discovery-tool. -# -# -# To build this image, from the directory containing this Dockerfile -# (assuming that the file is named Dockerfile): -# docker build -t . -# -# To Start software-discovery-tool use the following command. -# docker run --name -p :80 -d -# -# Test in the browser by using the following url: -# http://:/ -# http://:/software-discovery-tool -# -# Or by running the provided unit-tests: -# cd /opt/software-discovery-tool/src/tests -# pytest -######################################################################################## - -# Base image - FROM s390x/ubuntu:16.04 - -# The author - MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource) - -# Set environment variable - ENV SOURCE_DIR=/home - WORKDIR $SOURCE_DIR - -# Install dependencies -RUN apt-get update && apt-get install -y \ - python3 \ - python3-pip \ - gcc \ - git \ - python3-dev \ - libssl-dev \ - libffi-dev \ - cron \ - python3-lxml \ - apache2 \ - libapache2-mod-wsgi-py3 \ - -&& pip3 install 'cffi==1.11.5' \ - 'cryptography==1.4' \ - Flask \ - launchpadlib \ - simplejson \ - requests \ - pytest - - -#Set Environmental Variables -RUN echo $PATH -ENV PATH=/usr/local/bin:$PATH -RUN sh -c "echo 'export PATH=/usr/local/bin:$PATH' > /etc/profile.d/alternate_install_path.sh" - -# Clone software-discovery-tool from git -RUN cd /opt/ \ -&& git clone https://github.com/openmainframeproject/software-discovery-tool.git \ -&& cd software-discovery-tool \ - - -# Set Environmental Variables -&& sh -c "echo 'export PYTHONPATH=/opt/software-discovery-tool/src/classes:/opt/software-discovery-tool/src/config:$PYTHONPATH' > /etc/profile.d/software-discovery-tool.sh" \ - -# Copy the apache configuration file from /opt/software-discovery-tool/src/config/sdt.conf into respective apache configuration folder as below -&& cp -f /opt/software-discovery-tool/src/config/sdt.conf /etc/apache2/sites-enabled/sdt.conf \ -&& mv /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/z-000-default.conf \ - -#Create new user and group for apache -&& useradd apache \ - - -#Set appropriate folder and file permission on /opt/software-discovery-tool/ folder for apache -&& chown -R apache:apache /opt/software-discovery-tool/ \ - -# Clean up cache , source data and un-used packages - -&& apt-get remove -y \ - gcc \ - git \ - libssl-dev \ - libffi-dev \ - cron \ - && apt-get autoremove -y \ - && apt autoremove -y \ - && apt-get clean && rm -rf /var/lib/apt/lists/* $SOURCE_DIR - -# Expose port -EXPOSE 80 - -# Start Apache Http Server -CMD ["apachectl","-D", "FOREGROUND"] - -# End of Dockerfile