Commit d4bf7f5f authored by Recteur LP's avatar Recteur LP

Improve Container Entrypoint and change default config volume path

parent 0069fdc1
Pipeline #1565 passed with stages
in 9 minutes and 55 seconds
......@@ -38,7 +38,7 @@ build-el8: vendor auto-proxy
@buildah tag docker.io/pyrmin/pyrmin:el8-latest docker.io/pyrmin/pyrmin:el8-$(CI_COMMIT_TAG)
start:
@podman run --rm docker.io/pyrmin/pyrmin
@podman run --rm -p 8080 -e DEBUG=true -it docker.io/pyrmin/pyrmin
goss: test-build
@pgoss run localhost/pyrmin
......
......@@ -4,14 +4,10 @@ MAINTAINER pyrmin.io <support@pyrmin.io>
RUN dnf install -y 'dnf-command(config-manager)' epel-release \
&& dnf config-manager --set-enabled PowerTools \
&& dnf -y install \
dnf \
dnf-plugins-core \
createrepo_c \
python3-pip \
python3-setuptools \
python3-devel \
python3-virtualenv \
python3-createrepo_c \
python3-psutil \
python3-lxml \
git \
......@@ -21,7 +17,7 @@ RUN dnf install -y 'dnf-command(config-manager)' epel-release \
openldap-devel \
redhat-rpm-config \
&& useradd pyrmin \
&& mkdir -p /etc/pyrmin /usr/share/pyrmin/plugins /var/log/pyrmin /static \
&& mkdir -p /etc/pyrmin/plugins /usr/share/pyrmin/plugins /var/log/pyrmin /static \
&& python3 -m venv --symlinks --system-site-packages /opt/pyrmin \
&& source /opt/pyrmin/bin/activate \
&& cd /opt/tmp/ \
......@@ -37,5 +33,5 @@ RUN dnf install -y 'dnf-command(config-manager)' epel-release \
USER pyrmin
WORKDIR /var/log/pyrmin
EXPOSE 8080
VOLUME [ "/etc/pyrmin", "/usr/share/pyrmin/plugins", "/static" ]
VOLUME [ "/etc/pyrmin/plugins", "/usr/share/pyrmin/plugins", "/static" ]
CMD [ "/entrypoint.sh" ]
......@@ -6,12 +6,21 @@ UPGRADE=${UPGRADE:-false}
args="run"
[[ $UPGRADE == true ]] && args="--upgrade $args"
[[ $DEBUG == true ]] && set -x && args="--debug $args"
rsync --delete -av $(ls -d /opt/pyrmin/lib/python*/site-packages/pyrmin*/pyrmin/static)/ /static
[[ $UPGRADE == true ]] && args="--upgrade $args"
rsync --delete -a $(ls -d /opt/pyrmin/lib/python*/site-packages/pyrmin*/pyrmin/static)/ /static
source /opt/pyrmin/bin/activate
[ -n "$ROOT_URL" ] && sed -i "s#http://localhost:8080#$ROOT_URL#" /etc/pyrmin/pyrmin.yml
[ -n "$HTTP_PORT" ] && sed -i "s/#port: 8080/port: $HTTP_PORT/" /etc/pyrmin/pyrmin.yml
[ -n "$HTTP_TIMEOUT" ] && sed -i "s/#timeout: 120/timeout: $HTTP_TIMEOUT/" /etc/pyrmin/pyrmin.yml
[ -n "$GRAVATAR" ] && sed -i "s/#gravatar: false/gravatar: $GRAVATAR/" /etc/pyrmin/pyrmin.yml
[ -n "$AUTH_MODULE" ] && sed -i "s/#auth_module: None/auth_module: $AUTH_MODULE/" /etc/pyrmin/pyrmin.yml
[ -n "$PASSWORD" ] && sed -i "s/password: a1cb100f57e971cacf269e7c26e4630a25a8e9d4bdd35e32df1a80b66b896254/password: $PASSWORD/" /etc/pyrmin/pyrmin.yml
[ -n "$LOG_PATH" ] && sed -i "s:/var/log/pyrmin/access.log:$LOG_PATH:" /etc/pyrmin/pyrmin.yml
[ -n "$PLUGINS_PATH" ] && sed -i "s:/usr/share/pyrmin/plugins:$PLUGINS_PATH:" /etc/pyrmin/pyrmin.yml
/opt/pyrmin/bin/pyrmin $args 2>/dev/stdout
FROM registry.fedoraproject.org/fedora:32
FROM registry.fedoraproject.org/fedora:33
MAINTAINER pyrmin.io <support@pyrmin.io>
ENV TERM xterm
RUN dnf -v -y install \
dnf \
dnf-plugins-core \
createrepo_c \
python3-pip \
python3-setuptools \
python3-devel \
python-virtualenv \
python3-createrepo_c \
python3-psutil \
python3-lxml \
git \
......@@ -21,7 +15,7 @@ RUN dnf -v -y install \
openldap-devel \
redhat-rpm-config \
&& useradd pyrmin \
&& mkdir -p /etc/pyrmin /usr/share/pyrmin/plugins /var/log/pyrmin /static \
&& mkdir -p /etc/pyrmin/plugins /usr/share/pyrmin/plugins /var/log/pyrmin /static \
&& python3 -m venv --symlinks --system-site-packages /opt/pyrmin \
&& source /opt/pyrmin/bin/activate \
&& cd /opt/tmp/ \
......@@ -37,5 +31,5 @@ RUN dnf -v -y install \
USER pyrmin
WORKDIR /var/log/pyrmin
EXPOSE 8080
VOLUME [ "/etc/pyrmin", "/usr/share/pyrmin/plugins", "/static" ]
VOLUME [ "/etc/pyrmin/plugins", "/usr/share/pyrmin/plugins", "/static" ]
CMD [ "/entrypoint.sh" ]
......@@ -3,13 +3,10 @@ MAINTAINER pyrmin.io <support@pyrmin.io>
RUN yum -v -y install \
epel-release \
createrepo_c \
mariadb-devel \
python-pip \
python-virtualenv \
PyYAML \
python-setuptools \
python2-dnf \
python2-createrepo_c \
python2-psutil \
python2-lxml \
......@@ -18,10 +15,9 @@ RUN yum -v -y install \
rsync \
python-devel \
libyaml-devel \
openldap-devel \
redhat-rpm-config \
&& useradd pyrmin \
&& mkdir -p /etc/pyrmin /usr/share/pyrmin/plugins /var/log/pyrmin /static \
&& mkdir -p /etc/pyrmin/plugins /usr/share/pyrmin/plugins /var/log/pyrmin /static \
&& python2 -m virtualenv --system-site-packages /opt/pyrmin && source /opt/pyrmin/bin/activate \
&& cd /opt/tmp/ \
&& pip install -U setuptools pip \
......@@ -39,5 +35,5 @@ RUN yum -v -y install \
USER pyrmin
WORKDIR /var/log/pyrmin
EXPOSE 8080
VOLUME [ "/etc/pyrmin", "/usr/share/pyrmin/plugins", "/static" ]
VOLUME [ "/etc/pyrmin/plugins", "/usr/share/pyrmin/plugins", "/static" ]
CMD [ "/entrypoint.sh" ]
......@@ -9,9 +9,9 @@ from .plugins import Plugins
from ._menu import Menu
import cherrypy
import os
import yaml
import io
import os
import sys
import tempfile
......@@ -51,6 +51,8 @@ class Core():
8080
)
})
if "PLUGINS" in os.environ:
config['plugins'].append(os.environ["PLUGINS"].strip(","))
return config
else:
log.error("No configuration files found in " + config_path)
......
......@@ -53,7 +53,7 @@ class Plugins():
if "plugins" in config:
return config["plugins"]
else:
log.debug("Could not retrieve plugins list from config")
log.debug("No plugins activated")
return []
def __check_version(self, name):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment