I have a dockerfile that I am running via Drone to run an R script. The R script leverages a custom package to produce ggplots on Google Slides. When I run the script locally, it works total fine. This is the plot it produces, with custom font and ggtheme from my package.
GGplot R Studio Rendering: what the plot SHOULD look like.
But when I run it via the Dockerfile, everything works except....the text is just really tiny. I've played around with ggtheme and manually setting the text size, to no avail. It seems I've installed the font properly, given that it is in Libre Franklin, but it's just...so tiny! Anyone know what is up? I have some code in both my dockerfile and entrypoint that manually set the DPI, but that didn't seem to change anything either.
Here's what it actually looks like in the slide produced (tiny text).
I'm happy to share my other scripts if necessary, but any help would be MUCH appreciated, thank you!!
This is the dockerfile:
# DOCKER + SYSTEM SET UP #######################################################
FROM rocker/tidyverse:latest
# Install system dependencies (if any) for the R package
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libgit2-dev \
git \
jq \
curl \
wget \
fontconfig
# Install Xvfb and X11
RUN apt-get update && apt-get install -y \
xvfb \
x11-xserver-utils
# Start Xvfb in the background
CMD ["Xvfb", ":99", "-ac"]
# FONT INSTALLATION CODE #######################################################
# Download the Libre Franklin font (all weights) from Google Fonts
RUN wget https://fonts.google.com/download?family=Libre%20Franklin -O libre_franklin.zip
# Unzip and install the font
RUN unzip libre_franklin.zip -d /usr/share/fonts/ && fc-cache -f -v
# Clean up
RUN rm libre_franklin.zip
# R PACKAGE INSTALLATION CODE ##################################################
# Install CRAN packages
RUN R -e "install.packages(c('devtools', 'googledrive', 'googleCloudStorageR', 'googleAuthR', 'jsonlite', 'bigrquery', 'showtext'))"
# Argument for the GitHub token
ARG GITHUB_TOKEN
# Use the GitHub token to install from a private repository
RUN git config --global url."https://$GITHUB_TOKEN:@github.com/".insteadOf "https://github.com/" && \
R -e "devtools::install_github('nytimes/nytslider')"
# Install version-specific packages; we must do this after nytslider, since it installs them by default
RUN R -e "devtools::install_version('officer', version = '0.4.1')"
RUN R -e "devtools::install_version('flextable', version = '0.6.2')"
# Clean up GitHub token so it's not present in the image
RUN git config --global --unset url."https://$GITHUB_TOKEN:@github.com/".insteadOf
# COPY SCRIPT CODE #############################################################
COPY test_script.R /home/test_script.R
COPY mm_template.pptx /home/mm_template.pptx
COPY entrypoint.sh /entrypoint.sh
# RUN SCRIPT CODE #############################################################
# Make the entrypoint script executable
RUN chmod +x /entrypoint.sh
# Set the entrypoint script as the default command
ENTRYPOINT ["/entrypoint.sh"]