In dockerfile.alpine.sh, build-arg TAG_SUFFIX=minimal is not working

resulting images always include devtools.
Hardware: Raspberry PI 4 with 8Gb Ram
OS: PI OS Bullseye Full distribution
Docker standard image : 2.1.3 is running OK
Docker Custom Git freshly clone.

using docker.alpine.sh

Resulting image for TAG_SUFFIX=default is about 415 Mb
image with TAG_SUFFIX=minimal is about 415 Mb

In both case the execution log always shows devtools installation.
here is my docker.alpine.sh with minimal suffix


#!/bin/bash
export NODE_RED_VERSION=$(grep -oE "\"node-red\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4)

echo "#########################################################################"
echo "node-red version: ${NODE_RED_VERSION}"
echo "#########################################################################"

docker build --rm --no-cache \
    --build-arg ARCH=arm32v7 \
    --build-arg NODE_VERSION=12 \
    --build-arg NODE_RED_VERSION=${NODE_RED_VERSION} \
    --build-arg OS=alpine \
    --build-arg BUILD_DATE="$(date +"%Y-%m-%dT%H:%M:%SZ")" \
    --build-arg TAG_SUFFIX=minimal \
    --file Dockerfile.custom \
    --tag testing:nr136custmin .

I do not have to much experience on docker but I have made some modifications to scripts that
seems to produce a correct image.(without devtools)

Modified Dockerfile.custom
removed hardcoded value for TAG_SUFFIX

...
#### Stage RELEASE #####################################################################################################
FROM base AS RELEASE
ARG BUILD_DATE
ARG BUILD_VERSION
ARG BUILD_REF
ARG NODE_RED_VERSION
ARG ARCH
ARG TAG_SUFFIX
....

Modified scripts/install_devtools.sh
"minimal" instead "-minimal"


#!/bin/bash
set -ex

# Installing Devtools
if [[ ${TAG_SUFFIX} != "minimal" ]]; then
  echo "Installing devtools"
  apk add --no-cache --virtual devtools build-base linux-headers udev python2 python3
else
  echo "Skip installing devtools"
fi
-----------

After modifications the resulting iamge is about 218 Mb
and the image is running fine.

Raise a PR for review

But understand that the install_devtools.sh script needs to be shared with the automated build and that will always have -minimal as the tag.

Hi
docker.alpine.sh is calling Dockerfile.custom
In Dockerfile.custom many arguments are reassign
In Dockerfile.debian same thing happen

Is it ok to change Dockerfile.custom.sh and Dockerfile.debian.sh and remove those reassignement so that the only place they are assigned is from docker command in docker.alpine.sh and docker.debian.sh

Again I don't have a lot of experience with docker.

The entries in the Dockerfile's are purely default values if none are passed in on the command line.

Yep!
This is working good.

Thanks for your help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.