Skip to content

Commit

Permalink
Use the cache-from to correctly leverage staged docker container buil…
Browse files Browse the repository at this point in the history
…der to save time on creating panda packages
  • Loading branch information
AndrewQuijano committed Nov 23, 2024
1 parent 6498078 commit fd67c62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion panda/debian/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
panda.deb
*.deb
*.whl
8 changes: 4 additions & 4 deletions panda/debian/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ if [[ ! -f "../dependencies/ubuntu_${version}_base.txt" ]]; then
fi

# Build the installer to generate the wheel file
DOCKER_BUILDKIT=1 docker build --target installer -t panda --build-arg BASE_IMAGE="ubuntu:${version}" ../..
DOCKER_BUILDKIT=1 docker build --target installer -t panda_installer --build-arg BASE_IMAGE="ubuntu:${version}" ../..

# Copy wheel file out of container to host
# this also preserves wheel name, which is important as pip install WILL fail if you arbitarily change the generated wheel file name
docker run --rm -v $(pwd):/out panda bash -c "cp /panda/panda/python/core/dist/*.whl /out"
docker run --rm -v $(pwd):/out panda_installer bash -c "cp /panda/panda/python/core/dist/*.whl /out"

# Finish building main panda container for the target ubuntu version
DOCKER_BUILDKIT=1 docker build --target panda -t panda --build-arg BASE_IMAGE="ubuntu:${version}" ../..
DOCKER_BUILDKIT=1 docker build --target panda --cache-from=panda_installer -t panda --build-arg BASE_IMAGE="ubuntu:${version}" ../..

# Now build the packager container from that
docker build -t packager .
DOCKER_BUILDKIT=1 docker build --cache-from=panda -t packager .

# Copy deb file out of container to host
docker run --rm -v $(pwd):/out packager bash -c "cp /pandare.deb /out"
Expand Down
1 change: 1 addition & 0 deletions panda/python/core/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ data
a
__pycache__
*.egg-info
.eggs/

0 comments on commit fd67c62

Please sign in to comment.