Skip to content

Commit

Permalink
fine tune cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jodybro committed Dec 13, 2023
1 parent 4721659 commit cd5616a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,13 @@ jobs:
tags:
${{ steps.prep.outputs.tagged_image }},${{ steps.prep.outputs.image
}}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# syntax=docker/dockerfile:1.5
FROM python:3.10-slim-bookworm as builder
LABEL org=edenartlab
WORKDIR /app

ADD . /app

RUN apt-get update --fix-missing
# Copy only the file needed to install apt dependencies.
# This utilizes Docker's cache, because if these files have not changed,
# then we don't need to re-install the dependencies.
COPY apt-packages.txt apt-packages.txt

RUN apt-get install -y --fix-missing \
git build-essential cmake \
libgl1-mesa-glx libglib2.0-0
# No need for 2 layers of apt package installs
RUN apt-get update --fix-missing -y \
&& apt-get install -y --fix-missing $(cat apt-packages.txt) \
&& rm -rf /var/lib/apt/lists/* # Clean up to reduce layer size

RUN pip install --no-cache-dir -r requirements.txt
COPY requirements.txt requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt

RUN gdown 1Pm2apRxk9CbMspwve3Fir3WwX-vDWXoL

Expand Down
6 changes: 6 additions & 0 deletions apt-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
git
build-essential
cmake
libgl1-mesa-glx
libglib2.0-0

0 comments on commit cd5616a

Please sign in to comment.