Skip to content

Commit

Permalink
Move COPY from R image to after the Python COPY
Browse files Browse the repository at this point in the history
The R image is currently more frequently updated than the python one. Moving
this statement lower in the Dockerfile means we're more likely to take
advantage of caching to get slightly faster build times in most cases.
  • Loading branch information
lucyb committed May 3, 2024
1 parent dc5c863 commit 2655799
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ RUN --mount=type=cache,target=/var/cache/apt \
usermod -aG sudo rstudio &&\
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# copy the renv directory into the local site library from the OpenSAFELY R action image
# Copy the Python virtualenv from OpenSAFELY Python action image
#
# DL3022: hadolint can't access a network and doesn't behave
# as expected when a reference is made to an external image.
# hadolint ignore=DL3022
COPY --chown=rstudio:rstudio --from=ghcr.io/opensafely-core/r:latest /renv/lib/R-4.0/x86_64-pc-linux-gnu/ /usr/local/lib/R/site-library
COPY --chown=rstudio:rstudio --from=ghcr.io/opensafely-core/python:v2 /opt/venv /opt/venv

# Copy the Python virtualenv from OpenSAFELY Python action image
# copy the renv directory into the local site library from the OpenSAFELY R action image
#
# DL3022: hadolint can't access a network and doesn't behave
# as expected when a reference is made to an external image.
# hadolint ignore=DL3022
COPY --chown=rstudio:rstudio --from=ghcr.io/opensafely-core/python:v2 /opt/venv /opt/venv
COPY --chown=rstudio:rstudio --from=ghcr.io/opensafely-core/r:latest /renv/lib/R-4.0/x86_64-pc-linux-gnu/ /usr/local/lib/R/site-library

# Required for installing opensafely cli
ENV PATH="/home/rstudio/.local/bin:${PATH}"
Expand Down

0 comments on commit 2655799

Please sign in to comment.