diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ce3bc16 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +# This image is the base image for all OpenShift v3 language container images. +FROM registry.fedoraproject.org/f33/s2i-core:latest + +ENV SUMMARY="Base image with essential libraries and tools used as a base for \ +builder images like perl, python, ruby, etc." \ + DESCRIPTION="The s2i-base image, being built upon s2i-core, provides any \ +images layered on top of it with all the tools needed to use source-to-image \ +functionality. Additionally, s2i-base also contains various libraries needed for \ +it to serve as a base for other builder images, like s2i-python or s2i-ruby." \ + NAME=s2i-base \ + VERSION=1 \ + ARCH=x86_64 + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="s2i base" \ + com.redhat.component="$NAME" \ + name="$FGC/$NAME" \ + version="$VERSION" \ + maintainer="SoftwareCollections.org " + +# This is the list of basic dependencies that all language container image can +# consume. +RUN INSTALL_PKGS="autoconf \ + automake \ + bzip2 \ + gcc-c++ \ + gd-devel \ + gdb \ + git \ + libcurl-devel \ + libpq-devel \ + libxml2-devel \ + libxslt-devel \ + lsof \ + make \ + mariadb-connector-c-devel \ + npm \ + openssl-devel \ + patch \ + procps-ng \ + sqlite-devel \ + unzip \ + wget \ + which \ + zlib-devel" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + dnf clean all -y diff --git a/Dockerfile.fedora b/Dockerfile.fedora new file mode 120000 index 0000000..1d1fe94 --- /dev/null +++ b/Dockerfile.fedora @@ -0,0 +1 @@ +Dockerfile \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c6ace01 --- /dev/null +++ b/README.md @@ -0,0 +1,106 @@ +OpenShift base images +======================================== + +This repository contains Dockerfiles for images which serve as base images with all the +essential libraries and tools needed for OpenShift language images, for example: + +* [s2i-ruby](https://github.com/sclorg/s2i-ruby-container) +* [s2i-nodejs](https://github.com/sclorg/s2i-nodejs-container) +* [s2i-python](https://github.com/sclorg/s2i-python-container) +* [s2i-perl](https://github.com/sclorg/s2i-perl-container) +* [s2i-php](https://github.com/sclorg/s2i-php-container) + +This container image also installs several development libraries, that are +often required in the builder images above. It also includes NPM package manager. +Sharing those development packages in a common layer saves disk space and +improves pulling speed. + +NPM, a package manager for Node.js, offers a pleasant way to install JavaScript +libraries, that are often needed as static files for various web applications. +In order to offer good experience for web developers, the NPM package manager +is also installed in the image. + +For containers where the development libraries and NPM package manager are not +necessary, users are advised to use the s2i-core variant of this container image. + + +Description +----------- + +OpenShift S2I images use [Software Collections](https://www.softwarecollections.org/en/) +packages to provide the latest versions of various software. +The SCL packages are released more frequently than the RHEL or CentOS systems, +which are unlikely to change for several years. +We rely on RHEL and CentOS for base images, on the other hand, +because those are stable, supported, and secure platforms. + +Normally, SCL requires manual operation to enable the collection you want to use. +This is burdensome and can be prone to error. +The OpenShift S2I approach is to set Bash environment variables that +serve to automatically enable the desired collection: + +* `BASH_ENV`: enables the collection for all non-interactive Bash sessions +* `ENV`: enables the collection for all invocations of `/bin/sh` +* `PROMPT_COMMAND`: enables the collection in interactive shell + +Two examples: +* If you specify `BASH_ENV`, then all your `#!/bin/bash` scripts +do not need to call `scl enable`. +* If you specify `PROMPT_COMMAND`, then on execution of the +`podman exec ... /bin/bash` command, the collection will be automatically enabled. + +*Note*: +Executables in Software Collections packages (e.g., `ruby`) +are not directly in a directory named in the `PATH` environment variable. +This means that you cannot do: + + $ podman exec ... ruby + +but must instead do: + + $ podman exec ... /bin/bash -c ruby + +The `/bin/bash -c`, along with the setting the appropriate environment variable, +ensures the correct `ruby` executable is found and invoked. + +Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments + +Usage +------------------------ +Choose either the CentOS7 or RHEL7 base image: +* **RHEL7 base image** + +To build a RHEL7 based image, you need to build it on properly subscribed RHEL machine. + +``` +$ git clone --recursive https://github.com/sclorg/s2i-base-container.git +$ cd s2i-base-container +$ make build VERSIONS=base TARGET=rhel7 +``` + +* **CentOS7 base image** + +This image is available on DockerHub. To download it run: + +```console +podman pull quay.io/centos7/s2i-base-centos7 +``` + +To build a Base image from scratch run: + +``` +$ git clone --recursive https://github.com/sclorg/s2i-base-container.git +$ cd s2i-base-container +$ make build VERSIONS=base +``` + +**Notice: By omitting the `VERSION` parameter, the build/test action will be performed +on all provided versions of s2i image.** + + +See also +-------- +Dockerfile and other sources are available on https://github.com/sclorg/s2i-base-container. +In that repository you also can find another variants of S2I base Dockerfiles. +The Dockerfile for CentOS is called Dockerfile, the Dockerfile for RHEL7 is called Dockerfile.rhel7, +the Dockerfile for RHEL8 is called Dockerfile.rhel8 and the Dockerfile for Fedora is Dockerfile.fedora. diff --git a/base b/base new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/base @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/bot-cfg.yml b/bot-cfg.yml new file mode 100644 index 0000000..d40b2ac --- /dev/null +++ b/bot-cfg.yml @@ -0,0 +1,27 @@ +version: "1" + +betka: + # is betka enabled for this repository + # optional - defaults to false + enabled: true + + # optional + notifications: + email_addresses: [phracek@redhat.com] + + # Specify if master branch in upstream repository is synced + master_checker: true + # Should pull requests be synced? + # optional + pr_checker: false + # Either 'upstream_branch_name' or 'upstream_git_path' has to be specified + # Branch name which is used for sync + upstream_branch_name: master + # Path to directory with dockerfile withing upstream repository + upstream_git_path: "base" + # Github comment message to enforce sync of a pull request + # required if pr_checker is true otherwise optional + pr_comment_message: "[test]" + # optional + image_url: quay.io/rhscl/cwt-generator + diff --git a/dead.package b/dead.package deleted file mode 100644 index 7290702..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -container sources not used for building fedora containers anymore diff --git a/help.md b/help.md new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/help.md @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/root/help.1 b/root/help.1 new file mode 100644 index 0000000..887acd7 --- /dev/null +++ b/root/help.1 @@ -0,0 +1,153 @@ +.TH OpenShift base images +.PP +This repository contains Dockerfiles for images which serve as base images with all the +essential libraries and tools needed for OpenShift language images, for example: +.IP \(bu 2 +s2i\-ruby +\[la]https://github.com/sclorg/s2i-ruby-container\[ra] +.IP \(bu 2 +s2i\-nodejs +\[la]https://github.com/sclorg/s2i-nodejs-container\[ra] +.IP \(bu 2 +s2i\-python +\[la]https://github.com/sclorg/s2i-python-container\[ra] +.IP \(bu 2 +s2i\-perl +\[la]https://github.com/sclorg/s2i-perl-container\[ra] +.IP \(bu 2 +s2i\-php +\[la]https://github.com/sclorg/s2i-php-container\[ra] + +.PP +This container image also installs several development libraries, that are +often required in the builder images above. It also includes NPM package manager. +Sharing those development packages in a common layer saves disk space and +improves pulling speed. + +.PP +NPM, a package manager for Node.js, offers a pleasant way to install JavaScript +libraries, that are often needed as static files for various web applications. +In order to offer good experience for web developers, the NPM package manager +is also installed in the image. + +.PP +For containers where the development libraries and NPM package manager are not +necessary, users are advised to use the s2i\-core variant of this container image. + +.SH Description +.PP +OpenShift S2I images use Software Collections +\[la]https://www.softwarecollections.org/en/\[ra] +packages to provide the latest versions of various software. +The SCL packages are released more frequently than the RHEL or CentOS systems, +which are unlikely to change for several years. +We rely on RHEL and CentOS for base images, on the other hand, +because those are stable, supported, and secure platforms. + +.PP +Normally, SCL requires manual operation to enable the collection you want to use. +This is burdensome and can be prone to error. +The OpenShift S2I approach is to set Bash environment variables that +serve to automatically enable the desired collection: +.IP \(bu 2 +\fB\fCBASH\_ENV\fR: enables the collection for all non\-interactive Bash sessions +.IP \(bu 2 +\fB\fCENV\fR: enables the collection for all invocations of \fB\fC/bin/sh\fR +.IP \(bu 2 +\fB\fCPROMPT\_COMMAND\fR: enables the collection in interactive shell + +.PP +Two examples: +* If you specify \fB\fCBASH\_ENV\fR, then all your \fB\fC#!/bin/bash\fR scripts +do not need to call \fB\fCscl enable\fR\&. +* If you specify \fB\fCPROMPT\_COMMAND\fR, then on execution of the +\fB\fCdocker exec ... /bin/bash\fR command, the collection will be automatically enabled. + +.PP +\fINote\fP: +Executables in Software Collections packages (e.g., \fB\fCruby\fR) +are not directly in a directory named in the \fB\fCPATH\fR environment variable. +This means that you cannot do: + +.PP +.RS + +.nf +$ docker exec ... ruby + +.fi +.RE + +.PP +but must instead do: + +.PP +.RS + +.nf +$ docker exec ... /bin/bash \-c ruby + +.fi +.RE + +.PP +The \fB\fC/bin/bash \-c\fR, along with the setting the appropriate environment variable, +ensures the correct \fB\fCruby\fR executable is found and invoked. + +.SH Usage +.PP +Choose either the CentOS7 or RHEL7 base image: +* \fBRHEL7 base image\fP + +.PP +To build a RHEL7 based image, you need to build it on properly subscribed RHEL machine. + +.PP +.RS + +.nf +$ git clone \-\-recursive https://github.com/sclorg/s2i\-base\-container.git +$ cd s2i\-base\-container +$ make build VERSIONS=base TARGET=rhel7 + +.fi +.RE +.IP \(bu 2 +\fBCentOS7 base image\fP + +.PP +This image is available on DockerHub. To download it run: + +.PP +.RS + +.nf +docker pull sclorg/s2i\-base\-centos7 + +.fi +.RE + +.PP +To build a Base image from scratch run: + +.PP +.RS + +.nf +$ git clone \-\-recursive https://github.com/sclorg/s2i\-base\-container.git +$ cd s2i\-base\-container +$ make build VERSIONS=base + +.fi +.RE + +.PP +\fBNotice: By omitting the \fB\fCVERSION\fR parameter, the build/test action will be performed +on all provided versions of s2i image.\fP + +.SH See also +.PP +Dockerfile and other sources are available on +\[la]https://github.com/sclorg/s2i-base-container\[ra]\&. +In that repository you also can find another variants of S2I base Dockerfiles. +Dockerfile for CentOS is called Dockerfile, Dockerfile for RHEL is called Dockerfile.rhel7. diff --git a/test/run b/test/run new file mode 100755 index 0000000..ba51036 --- /dev/null +++ b/test/run @@ -0,0 +1,26 @@ +#!/bin/bash +# +# The 'run' performs a simple test that verifies that STI image. +# The main focus is that the image prints out the base-usage properly. +# +# IMAGE_NAME specifies a name of the candidate image used for testing. +# The image has to be available before this script is executed. +# +test -n "${IMAGE_NAME-}" || { echo 'make sure $IMAGE_NAME is defined'; exit 1; } + +test_docker_run_usage() { + echo "Testing 'docker run' usage..." + docker run --rm ${IMAGE_NAME} &>/dev/null +} + +check_result() { + local result="$1" + if [[ "$result" != "0" ]]; then + echo "STI image '${IMAGE_NAME}' test FAILED (exit code: ${result})" + exit $result + fi +} + +# Verify the 'usage' script is working properly when running the base image with 'docker run ...' +test_docker_run_usage +check_result $?