Skip to content

Commit

Permalink
add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rxu17 committed Oct 17, 2024
1 parent f412a80 commit de3ebef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ jobs:
uses: docker/build-push-action@v5
with:
context: scripts/references
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-cache,mode=max

7 changes: 5 additions & 2 deletions scripts/references/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ RUN R -e "remotes::install_version('synapser', version = '0.11.7', repos = c('ht
# Set Python environment variable for R
ENV PYTHON /usr/local/lib/R/site-library/PythonEmbedInR/bin/python3.6

# Copy the local project files into the container
COPY . .
# Copy only renv.lock first to leverage Docker cache for dependencies
COPY renv.lock renv.lock

# Restore R environment with renv
RUN R -e "renv::restore()"

# Copy the local project files into the container
COPY . .

0 comments on commit de3ebef

Please sign in to comment.