commit 84ef167fd46339977fd5d7ac2a0df049fca06fb247bd06ac5524adbf9a776fa3 Author: Dan Čermák Date: Thu Apr 28 12:35:52 2022 +0000 First version of BCI based on Tumbleweed OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/rmt-server-image?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0ff1128 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: MIT +#!BuildTag: suse/rmt-server:2.7 +#!BuildTag: suse/rmt-server:2.7-%RELEASE% +FROM opensuse/tumbleweed:latest + +MAINTAINER SUSE LLC (https://www.suse.com/) + +# Define labels according to https://en.opensuse.org/Building_derived_containers +# labelprefix=com.suse.application.rmt-server +LABEL org.opencontainers.image.title="SLE RMT Server Container Image" +LABEL org.opencontainers.image.description="SUSE RMT Server based on the SLE Base Container Image." +LABEL org.opencontainers.image.version="2.7" +LABEL org.opencontainers.image.url="https://www.suse.com/products/server/" +LABEL org.opencontainers.image.created="%BUILDTIME%" +LABEL org.opencontainers.image.vendor="SUSE LLC" +LABEL org.opensuse.reference="registry.suse.com/suse/rmt-server:2.7-%RELEASE%" +LABEL org.openbuildservice.disturl="%DISTURL%" +LABEL com.suse.supportlevel="techpreview" +LABEL com.suse.eula="sle-bci" +LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle" +LABEL com.suse.image-type="application" +LABEL com.suse.release-stage="beta" +# endlabelprefix + + +RUN set -euo pipefail && zypper -n in --no-recommends rmt-server catatonit && zypper -n clean && rm -rf /var/log/* + +ENV RAILS_ENV="production" +ENV LANG="en" +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["/usr/share/rmt/bin/rails", "server", "-e", "production"] +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh diff --git a/_service b/_service new file mode 100644 index 0000000..52b4539 --- /dev/null +++ b/_service @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..3c6f6aa --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +# PV could be empty, make sure the directories exist +mkdir -p /var/lib/rmt/public/repo +mkdir -p /var/lib/rmt/public/suma +mkdir -p /var/lib/rmt/regsharing +mkdir -p /var/lib/rmt/tmp +# Set permissions +chown -R _rmt:nginx /var/lib/rmt + +if [ -z "${MYSQL_HOST}" ]; then + echo "MYSQL_HOST not set!" + exit 1 +fi +if [ -z "${MYSQL_PASSWORD}" ]; then + echo "MYSQL_PASSWORD not set!" + exit 1 +fi + +MYSQL_DATABASE="${MYSQL_DATABASE:-rmt}" +MYSQL_USER="${MYSQL_USER:-rmt}" + +# Create adjusted /etc/rmt.conf +echo -e "database:\n host: ${MYSQL_HOST}\n database: ${MYSQL_DATABASE}\n username: ${MYSQL_USER}\n password: ${MYSQL_PASSWORD}" > /etc/rmt.conf +echo -e " adapter: mysql2\n encoding: utf8\n timeout: 5000\n pool: 5\n" >> /etc/rmt.conf +echo -e "scc:\n username: ${SCC_USERNAME}\n password: ${SCC_PASSWORD}\n sync_systems: true\n" >> /etc/rmt.conf +echo -e "log_level:\n rails: debug" >> /etc/rmt.conf + +if [ $# -eq 0 ]; then + set -- /usr/share/rmt/bin/rails server -e production +fi + +if [ "$1" == "/usr/share/rmt/bin/rails" -a "$2" == "server" ]; then + echo "Create/migrate RMT database" + pushd /usr/share/rmt > /dev/null + /usr/share/rmt/bin/rails db:create db:migrate RAILS_ENV=production + popd > /dev/null + echo "Syncing product list" + rmt-cli sync + for PRODUCT in $SCC_PRODUCT_ENABLE + do + rmt-cli products enable $PRODUCT + done + for PRODUCT in $SCC_PRODUCT_DISABLE + do + rmt-cli products disable $PRODUCT + done + rmt-cli repos clean + echo "Executing: catatonit -- $@" + exec catatonit -- "$@" +else + echo "Executing: $@" + exec "$@" +fi diff --git a/rmt-server-image.changes b/rmt-server-image.changes new file mode 100644 index 0000000..473a0f4