Skip to content
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: 6 additions & 1 deletion Dockerfile.multistage
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,19 @@ COPY --from=builder /build/renv /app/renv
COPY --from=builder /build/.Rprofile /app/.Rprofile
COPY --from=builder /build/renv.lock /app/renv.lock

# Copy the renv cache (symlinks in renv/library point to this cache)
COPY --from=builder /root/.cache/R/renv /root/.cache/R/renv

# Copy application code
COPY --from=builder /build/app.R /app/app.R

# Expose Shiny port
EXPOSE 3838

# Run the application
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
# Note: Use --vanilla to skip .Rprofile and avoid renv activation at runtime
# The renv library path is already in R's search path
CMD ["R", "--vanilla", "-e", ".libPaths('/app/renv/library/linux-ubuntu-noble/R-4.4/x86_64-pc-linux-gnu'); shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]

# ============================================================================
# Build and Run Commands:
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.single-stage
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ RUN R -e "renv::restore()"
EXPOSE 3838

# Run the application
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
# Note: Use --vanilla to skip .Rprofile and avoid renv activation at runtime
# The renv library path is already in R's search path
CMD ["R", "--vanilla", "-e", ".libPaths('/app/renv/library/linux-ubuntu-noble/R-4.4/x86_64-pc-linux-gnu'); shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
7 changes: 6 additions & 1 deletion Dockerfile.three-stage
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ COPY --from=base /base/renv /app/renv
COPY --from=base /base/.Rprofile /app/.Rprofile
COPY --from=base /base/renv.lock /app/renv.lock

# Copy the renv cache (symlinks in renv/library point to this cache)
COPY --from=base /root/.cache/R/renv /root/.cache/R/renv

# Copy custom packages from builder stage (if any were installed)
# COPY --from=builder /usr/local/lib/R/site-library/mypackage /usr/local/lib/R/site-library/mypackage

Expand All @@ -118,7 +121,9 @@ COPY --from=builder /build/app.R /app/app.R
EXPOSE 3838

# Run the application
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
# Note: Use --vanilla to skip .Rprofile and avoid renv activation at runtime
# The renv library path is already in R's search path
CMD ["R", "--vanilla", "-e", ".libPaths('/app/renv/library/linux-ubuntu-noble/R-4.4/x86_64-pc-linux-gnu'); shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]

# ============================================================================
# Layer Optimization Strategy:
Expand Down