diff --git a/Dockerfile b/Dockerfile index 0192392..8485dc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,13 @@ ENV NB_GID=997 COPY fix-permissions.sh /usr/local/bin RUN fix-permissions.sh /usr/local/lib/R -COPY shiny-server.conf /etc/shiny-server/shiny-server.conf +RUN apt-get update && apt-get install -y \ + gettext-base + +COPY shiny-server.conf.tpl /shiny-server.conf.tpl +COPY docker-entrypoint.sh /docker-entrypoint.sh +RUN chown shiny:shiny /etc/shiny-server/shiny-server.conf USER shiny +ENTRYPOINT ["/bin/sh", "/docker-entrypoint.sh"] +CMD ["/init"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..0e7bac8 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2025 - Swiss Data Science Center (SDSC) +# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and +# Eidgenössische Technische Hochschule Zürich (ETHZ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +envsubst < /shiny-server.conf.tpl > /etc/shiny-server/shiny-server.conf + +echo "Using shiny-server.conf:" +cat /etc/shiny-server/shiny-server.conf + +exec "$@" diff --git a/shiny-server.conf b/shiny-server.conf.tpl similarity index 84% rename from shiny-server.conf rename to shiny-server.conf.tpl index 97671ae..13f6434 100644 --- a/shiny-server.conf +++ b/shiny-server.conf.tpl @@ -5,8 +5,8 @@ run_as shiny; server { listen 3838; - # Define a location at the base URL - location / { + # Renku will pass in the base URL path to the container + location /$RENKU_BASE_URL_PATH/ { # Host the directory of Shiny Apps stored in this directory site_dir /srv/shiny-server;