Skip to content

Commit

Permalink
Select to run google-authenticator.sh at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangwooLim committed Sep 1, 2024
1 parent ee9a296 commit 7cdce21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
13 changes: 2 additions & 11 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ RUN /rocker_scripts/install_rstudio.sh
# Copy scripts
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY create_user.sh /usr/local/bin/create_user.sh
COPY google-authenticator.sh /usr/local/bin/google-authenticator.sh
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf

RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/create_user.sh
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/create_user.sh /usr/local/bin/google-authenticator.sh

# Define argument for username and password with default values
ARG USERNAME=limcw
Expand All @@ -57,16 +58,6 @@ ARG PASSWORD=limcw
# Create the user with specified username and password
RUN /usr/local/bin/create_user.sh ${USERNAME} ${PASSWORD} yes

# Define an argument for using Google Authenticator
ARG USE_GOOGLE_AUTHENTICATOR=false

# If USE_GOOGLE_AUTHENTICATOR is true, copy and run the google-authenticator script
RUN if [ "$USE_GOOGLE_AUTHENTICATOR" = "true" ]; then \
cp /path/to/google-authenticator.sh /usr/local/bin/google-authenticator.sh && \
chmod +x /usr/local/bin/google-authenticator.sh && \
/usr/local/bin/google-authenticator.sh; \
fi

# Copy supervisord configuration
COPY supervisord.conf /etc/supervisord.conf

Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash

if [ "${USE_GOOGLE_AUTHENTICATOR}" = "true" ]; then
cp /path/to/google-authenticator.sh /usr/local/bin/google-authenticator.sh &&
chmod +x /usr/local/bin/google-authenticator.sh &&
/usr/local/bin/google-authenticator.sh
fi

# Start supervisord
/usr/bin/supervisord -c /etc/supervisord.conf

0 comments on commit 7cdce21

Please sign in to comment.