fix: do not retag images unnecessarily

This change minimizes the work needed to be done when tagging images. It edits the image manifest directly only when necessary, allowing restarts of an app to avoid having an extra layer.

This also additionally allows to deploy images with ONBUILD directives without running the ONBUILD directives.

Lastly, users building docker images that run Dokku will need to use a new sudoer wrapper for the `docker-image-labeler` binary to work correctly. A reference version has been placed in the `docker` skeleton directory.

Closes #3931
Refs #4226
This commit is contained in:
Jose Diaz-Gonzalez
2021-01-23 23:00:22 -05:00
parent 162abcee4f
commit 9306011f70
11 changed files with 107 additions and 22 deletions

View File

@@ -7,6 +7,13 @@ install_dependencies() {
echo "=====> install_dependencies on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
mkdir -p "$ROOT_DIR/build/"
DOCKER_IMAGE_LABELER_VERSION=$(grep DOCKER_IMAGE_LABELER_VERSION "${ROOT_DIR}/Makefile" | head -n1 | cut -d' ' -f3)
DOCKER_IMAGE_LABELER_PACKAGE_NAME="docker-image-labeler_${DOCKER_IMAGE_LABELER_VERSION}_amd64.deb"
if [[ ! -f "$ROOT_DIR/build/${DOCKER_IMAGE_LABELER_PACKAGE_NAME}" ]]; then
curl -L "https://packagecloud.io/dokku/dokku/packages/ubuntu/bionic/docker-image-labeler_${DOCKER_IMAGE_LABELER_VERSION}_amd64.deb/download.deb" -o "$ROOT_DIR/build/${DOCKER_IMAGE_LABELER_PACKAGE_NAME}"
fi
HEROKUISH_VERSION=$(grep HEROKUISH_VERSION "${ROOT_DIR}/Makefile" | head -n1 | cut -d' ' -f3)
HEROKUISH_PACKAGE_NAME="herokuish_${HEROKUISH_VERSION}_amd64.deb"
if [[ ! -f "$ROOT_DIR/build/${HEROKUISH_PACKAGE_NAME}" ]]; then
@@ -42,11 +49,13 @@ install_dependencies() {
sudo apt-get -qq -y --no-install-recommends install cgroupfs-mount dos2unix jq nginx debconf-utils
sudo cp "${ROOT_DIR}/tests/dhparam.pem" /etc/nginx/dhparam.pem
sudo dpkg -i "${ROOT_DIR}/build/$HEROKUISH_PACKAGE_NAME" \
sudo dpkg -i \
"${ROOT_DIR}/build/$DOCKER_IMAGE_LABELER_PACKAGE_NAME" \
"${ROOT_DIR}/build/$HEROKUISH_PACKAGE_NAME" \
"${ROOT_DIR}/build/$PLUGN_PACKAGE_NAME" \
"${ROOT_DIR}/build/$SSHCOMMAND_PACKAGE_NAME" \
"${ROOT_DIR}/build/$PROCFILE_UTIL_PACKAGE_NAME" \
"${ROOT_DIR}/build/$SIGIL_PACKAGE_NAME" \
"${ROOT_DIR}/build/$PROCFILE_UTIL_PACKAGE_NAME"
"${ROOT_DIR}/build/$SSHCOMMAND_PACKAGE_NAME"
}
build_dokku() {
@@ -149,10 +158,10 @@ setup_circle() {
getent passwd | cut -d: -f1 | sort
sudo -E mkdir -p /home/dokku/.dokkurc
if [[ -n "$GITHUB_ACTIONS" ]]; then
sudo -E chown dokku:dokku /home/dokku/.dokkurc
else
if [[ -n "$CIRCLECI" ]]; then
sudo -E chown dokku:ubuntu /home/dokku/.dokkurc
else
sudo -E chown dokku:dokku /home/dokku/.dokkurc
fi
sudo -E chmod 775 /home/dokku/.dokkurc
# pull node:4-alpine image for testing