Skip to content

Commit

Permalink
chore(all): update to 0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tossp committed Sep 15, 2021
1 parent c428c8e commit a7fa0ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
9 changes: 6 additions & 3 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ THX @haydibe
- Supports to bind a local redpill-load folder into the container (set `"docker.local_rp_load_use": "true"` and set `"docker.local_rp_load_path": "path/to/rp-load"`)
- Supports to clean old image versions and the build cache per <platform_version> or for `all` of them at once.
- Supports to auto clean old image versions and the build cache for the current build image, set `"docker.auto_clean":`to `"true"`.
- Allows to configure if the build cache is used or not ("docker.use_build_cache")
- Allows to specify if "clean all" should delete all or only orphaned images.
## Changes
- `clean` now cleans the build cache as well
- added `auto_clean` to clean old images and build cache after building the image.
- fixed usage of label that determins the redpill-tool-chain images for clean up
- add `"docker.use_build_cache": "false"` to global_settings.json
- add `"docker.clean_images": "all"` to global_settings.json

## Usage

Expand Down Expand Up @@ -51,7 +54,7 @@ Actions: build, auto, run, clean
Interactive Bash terminal.
- clean: Removes old (=dangling) images and the build cache for a platform version.
Use `all` as platform version to remove images and build caches for all platform versions.
Use `all` as platform version to remove images and build caches for all platform versions. `"docker.clean_images"`="all" only has affect with clean all.
Available platform versions:
---------------------
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ ADD downloads/${KERNEL_SRC_FILENAME} /
# tool chain image
FROM ${DOCKER_BASE_IMAGE}

LABEL redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION}

ARG DEBIAN_FRONTEND=noninteractive
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sed -i "s/archive.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list && \
Expand All @@ -35,6 +33,8 @@ ARG DSM_VERSION
ARG COMPILE_WITH
ARG TARGET_REVISION

LABEL redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION}

ENV ARCH=x86_64 \
LINUX_SRC=${REDPILL_LKM_SRC}/${COMPILE_WITH}-${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} \
REDPILL_LKM_SRC=${REDPILL_LKM_SRC} \
Expand Down
4 changes: 3 additions & 1 deletion global_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"download_folder": "docker/downloads",
"local_rp_load_use": "false",
"local_rp_load_path": "./redpill-load",
"auto_clean": "false"
"auto_clean": "false",
"use_build_cache": "false",
"clean_images": "all"
},
"build_configs": [
{
Expand Down
7 changes: 5 additions & 2 deletions redpill_tool_chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function getValueByJsonPath(){
function buildImage(){
[ "${USE_BUILDKIT}" == "true" ] && export DOCKER_BUILDKIT=1
docker build --file docker/Dockerfile --force-rm --pull \
$( [ "${USE_BUILD_CACHE}" == "false" ] && echo "--no-cache" ) \
--build-arg DOCKER_BASE_IMAGE="${DOCKER_BASE_IMAGE}" \
--build-arg COMPILE_WITH="${COMPILE_WITH}" \
--build-arg EXTRACTED_KSRC="${EXTRACTED_KSRC}" \
Expand All @@ -35,10 +36,10 @@ function clean(){
docker system df
fi
if [ "${ID}" == "all" ];then
OLD_IMAGES=$(docker image ls --filter label=redpill-tool-chain --filter dangling=true --quiet)
OLD_IMAGES=$(docker image ls --filter label=redpill-tool-chain --quiet $( [ "${CLEAN_IMAGES}" == "orphaned" ] && echo "--filter dangling=true"))
docker builder prune --filter label=redpill-tool-chain --force
else
OLD_IMAGES=$(docker image ls --filter label=redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} --filter dangling=true --quiet)
OLD_IMAGES=$(docker image ls --filter label=redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} --quiet --filter dangling=true)
docker builder prune --filter label=redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} --force
fi

Expand Down Expand Up @@ -128,6 +129,8 @@ REDPILL_LOAD_IMAGES=${PWD}/images
CONFIG=$(readConfig)
AVAILABLE_IDS=$(getValueByJsonPath ".build_configs[].id" "${CONFIG}")
AUTO_CLEAN=$(getValueByJsonPath ".docker.auto_clean" "${CONFIG}")
USE_BUILD_CACHE=$(getValueByJsonPath ".docker.use_build_cache" "${CONFIG}")
CLEAN_IMAGES=$(getValueByJsonPath ".docker.clean_images" "${CONFIG}")

if [ $# -lt 2 ]; then
showHelp
Expand Down

0 comments on commit a7fa0ff

Please sign in to comment.