How to Use Custom HTML Template for Containerized Docker

#1

SOLVED. SEE BELOW.

ORIGINAL QUESTION:

First, thanks for this awesome tool.

I am trying to use the custom templates found on the ShinyProxy GitHub page. (I’m limited to two links.)

Everything works fine (application launches, etc.) except for the the new landing page layout/theme; I still see the default bullet layout.

Capture

Here is my application.yml:

proxy:
  title: Company Analytics
  template-path: ./templates/1col
  port: 807
  container-wait-time: 100000
  authentication: none
  docker:
    url: http://host.docker.internal:2375
    internal-networking: true
  specs:
  - id: shiny_planting_schedule
    display-name: Planting Schedule
    description: Linear programming to optimize planting schedule.
    container-cmd: ["R", "-e", "source('/root/shiny_planting_schedule/source_file.R')"]
    container-image: shiny_planting_schedule
    container-network: sp-example-net
logging:
  file:
    shinyproxy.log

And I’m using the same Dockerfile provided in 02-containerized-docker-engine:

FROM openjdk:8-jre

RUN mkdir -p /opt/shinyproxy/
RUN wget https://www.shinyproxy.io/downloads/shinyproxy-2.2.1.jar -O /opt/shinyproxy/shinyproxy.jar
COPY application.yml /opt/shinyproxy/application.yml

WORKDIR /opt/shinyproxy/
CMD ["java", "-jar", "/opt/shinyproxy/shinyproxy.jar"]

To run the Dockerfile I do the following in PowerShell:

cd C:\Users\user\Documents\R\shinyproxy\test
docker network create sp-example-net
docker build . -t test
docker run -d --name test --net sp-example-net -p 807:807 test

The templates/1col folder is in the same folder as the Dockerfile and the application.yml.

I tried following the tutorial outlined in 04-custom-html-template but then I get a container failed to start error.

SOLUTION:

The answer is embarrassingly simple. The Dockerfile needs to be edited so that the templates folder is copied into the image.

The edited Dockerfile:

FROM openjdk:8-jre

RUN mkdir -p /opt/shinyproxy/
RUN wget https://www.shinyproxy.io/downloads/shinyproxy-2.2.1.jar -O /opt/shinyproxy/shinyproxy.jar
COPY application.yml /opt/shinyproxy/application.yml
RUN mkdir /opt/shinyproxy/templates
ADD templates /opt/shinyproxy/templates

WORKDIR /opt/shinyproxy/
CMD ["java", "-jar", "/opt/shinyproxy/shinyproxy.jar"]

Thanks again to the ShinyProxy developers for an amazing platform!

1 Like
#2

SOLVED:

The answer is embarrassingly simple. The Dockerfile needs to be edited so that the templates folder is copied into the image.

The edited Dockerfile:

FROM openjdk:8-jre

RUN mkdir -p /opt/shinyproxy/
RUN wget https://www.shinyproxy.io/downloads/shinyproxy-2.2.1.jar -O /opt/shinyproxy/shinyproxy.jar
COPY application.yml /opt/shinyproxy/application.yml
RUN mkdir /opt/shinyproxy/templates
ADD templates /opt/shinyproxy/templates

WORKDIR /opt/shinyproxy/
CMD ["java", "-jar", "/opt/shinyproxy/shinyproxy.jar"]

Thanks again to the ShinyProxy developers for an amazing platform!