Skip to content

Refactoring config generation, reducing copy & paste #1155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NodeBase/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,11 @@ ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
# Creating base directory for Xvfb
RUN sudo mkdir -p /tmp/.X11-unix && sudo chmod 1777 /tmp/.X11-unix

# Copying configuration script generator
COPY generate_config /opt/bin/generate_config

# Generating a default config during build time
RUN /opt/bin/generate_config


EXPOSE 5900
24 changes: 9 additions & 15 deletions NodeOpera/generate_config → NodeBase/generate_config
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
#!/bin/bash

# OPERA_VERSION=$(opera -version)

echo "[node]
max-concurrent-sessions = ${SE_NODE_MAX_CONCURRENT_SESSIONS}
[events]
echo "[events]
publish = \"tcp://${SE_EVENT_BUS_HOST}:${SE_EVENT_BUS_PUBLISH_PORT}\"
subscribe = \"tcp://${SE_EVENT_BUS_HOST}:${SE_EVENT_BUS_SUBSCRIBE_PORT}\"
" > /opt/selenium/config.toml


if [[ -z "${SE_NODE_HOST}" ]] || [[ -z "${SE_NODE_PORT}" ]]; then
echo "SE_NODE_HOST and SE_NODE_PORT not found."
else
echo "[server]" >> /opt/selenium/config.toml
fi

if [[ -z "${SE_NODE_HOST}" ]] || [[ -z "${SE_NODE_PORT}" ]]; then
echo "SE_NODE_HOST and SE_NODE_PORT not found."
echo "Configuring server..."
else
echo "[server]" >> /opt/selenium/config.toml
fi

if [[ -z "${SE_NODE_HOST}" ]]; then
echo "Using default SE_NODE_HOST."
echo "Setting up SE_NODE_HOST..."
else
echo "hostname = \"${SE_NODE_HOST}\"" >> /opt/selenium/config.toml
fi

if [[ -z "${SE_NODE_PORT}" ]]; then
echo "Using default SE_NODE_PORT."
echo "Setting up SE_NODE_PORT..."
else
echo "port = \"${SE_NODE_PORT}\"" >> /opt/selenium/config.toml
fi

echo "[node]
max-concurrent-sessions = ${SE_NODE_MAX_CONCURRENT_SESSIONS}
" >> /opt/selenium/config.toml

5 changes: 0 additions & 5 deletions NodeChrome/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,3 @@ RUN if [ -z "$CHROME_DRIVER_VERSION" ]; \
&& mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& chmod 755 /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& sudo ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver

COPY generate_config /opt/bin/generate_config

# Generating a default config during build time
RUN /opt/bin/generate_config
35 changes: 0 additions & 35 deletions NodeChrome/generate_config

This file was deleted.

12 changes: 0 additions & 12 deletions NodeFirefox/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,3 @@ RUN GK_VERSION=$(if [ ${GECKODRIVER_VERSION:-latest} = "latest" ]; then echo "0.
&& ln -fs /opt/geckodriver-$GK_VERSION /usr/bin/geckodriver

USER 1200

COPY generate_config /opt/bin/generate_config

# Generating a default config during build time
RUN /opt/bin/generate_config

#==========
# Relaxing permissions for OpenShift and other non-sudo environments
#==========
RUN sudo chmod -R 777 ${HOME} \
&& sudo chgrp -R 0 ${HOME} \
&& sudo chmod -R g=u ${HOME}
36 changes: 0 additions & 36 deletions NodeFirefox/generate_config

This file was deleted.

5 changes: 0 additions & 5 deletions NodeOpera/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,3 @@ RUN LATEST_VERSION=$(curl -s https://api.github.com/repos/operasoftware/operachr
&& rm -rf /tmp/operadriver_linux64* \
&& chmod 755 /opt/selenium/operadriver-${OPERA_DRIVER_VERSION} \
&& sudo ln -fs /opt/selenium/operadriver-${OPERA_DRIVER_VERSION} /usr/bin/operadriver

COPY generate_config /opt/bin/generate_config

# Generating a default config during build time
RUN /opt/bin/generate_config