Skip to content

Commit

Permalink
optimize google cloud run parameters to better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
langbart committed Jul 13, 2024
1 parent e8ac4f5 commit ebe135b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy-cloudrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ jobs:
service: ${{ env.SERVICE }}
image: ${{ env.CONTAINER_REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
region: ${{ env.REGION }}
flags: "--cpu=2 --memory=1024M --concurrency=80 --max-instances=5"

flags: "--cpu=2 --memory=2048M --concurrency=40 --max-instances=10"
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}
34 changes: 16 additions & 18 deletions prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
FROM rocker/shiny:4
FROM rocker/shiny:4.1.0

# install R package dependencies
# Install system dependencies and clean up
RUN apt-get update && apt-get install --no-install-recommends -y \
libv8-dev \
## clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds
&& rm -rf /var/lib/apt/lists/* /tmp/downloaded_packages/ /tmp/*.rds

# Extra R packages
# Install R packages that are less likely to change
RUN install2.r --error --skipinstalled -n 2 \
remotes \
config \
Expand All @@ -25,28 +23,28 @@ RUN install2.r --error --skipinstalled -n 2 \
purrr \
stringr \
deckgl \
htmlwidgets
htmlwidgets \
&& Rscript -e 'remotes::install_github(c("dreamRs/d3.format@0a7656f36e4425c0da09802961cf95855b4b85e6"))' \
&& Rscript -e 'remotes::install_github("timelyportfolio/dataui")' \
&& Rscript -e 'remotes::install_version("apexcharter", version = "0.4.2")'

RUN Rscript -e 'remotes::install_github(c( \
"dreamRs/d3.format@0a7656f36e4425c0da09802961cf95855b4b85e6" \
))'
RUN Rscript -e 'remotes::install_github("timelyportfolio/dataui")'
RUN Rscript -e 'remotes::install_version("apexcharter", version = "0.4.2")'


COPY inst /srv/shiny-server/inst
COPY R /srv/shiny-server/R
# Copy application dependencies and install local package
COPY DESCRIPTION /srv/shiny-server/DESCRIPTION
COPY NAMESPACE /srv/shiny-server/NAMESPACE
COPY data /srv/shiny-server/data

RUN Rscript -e 'remotes::install_local("/srv/shiny-server", dependencies = FALSE)'

# Copy remaining application files
COPY inst /srv/shiny-server/inst
COPY R /srv/shiny-server/R
COPY data /srv/shiny-server/data
COPY shiny.config /etc/shiny-server/shiny-server.conf
COPY app.R /srv/shiny-server/app.R

# Expose port 8080
EXPOSE 8080

# Use shiny user
USER shiny

# Start the Shiny server
CMD ["/usr/bin/shiny-server"]

0 comments on commit ebe135b

Please sign in to comment.