sudomesh / sudowrt-firmware

Scripts to build the sudo mesh OpenWRT firmware.
Other
73 stars 19 forks source link

base docker hub image should not contain any files/configs #162

Closed paidforby closed 4 years ago

paidforby commented 4 years ago

The docker hub builder image stored here should not contain any of the files and configurations that are commonly stored in the repo.

The reason being that it becomes very difficult to remove any files from a docker container before starting it. This means that if you would like to build the firmware without a specific config file, say /etc/config/network and instead just leave this the network config as the openwrt default, it requires unnecessary docker magic.

The docker hub image should only contain the built_firmware directory which is created after running the firmware build once and is what gives us faster build times. Everything else should be copied in prior to starting the docker container.

I believe this will also cause more errors, but less false positive builds, i.e. where it looks like its building the correct firmware with the correct files, but actually has incorrect or outdated files from the first build.

Solution: Update Dockerfile to delete everything except built_firmware. Rebuild a docker image and upload it to docker hub.

paidforby commented 4 years ago

Added following lines to Dockerfile

RUN find . -maxdepth 1 -type f ! -name 'entrypoint.sh'  -exec rm -f {} +
RUN find . -maxdepth 1 -type d ! -name '.' ! -name 'built_firmware' -exec rm -rf {} +

Pushed new image to docker hub, see that latest image history includes these lines.