2023-03-25 11:27:22 -07:00
|
|
|
# syntax=docker/dockerfile:latest
|
2022-10-20 18:48:17 -07:00
|
|
|
ARG BASE_IMAGE
|
|
|
|
FROM $BASE_IMAGE
|
2023-01-17 11:53:24 -08:00
|
|
|
ARG BASE_IMAGE
|
2023-01-21 22:22:41 -08:00
|
|
|
ARG SYSADMIN_PW
|
2022-10-20 18:48:17 -07:00
|
|
|
ARG LINUX_DISTRO=alpine
|
2023-04-03 14:14:17 -07:00
|
|
|
WORKDIR /build
|
2022-10-20 18:48:17 -07:00
|
|
|
|
2023-03-22 09:10:54 -07:00
|
|
|
# PACKAGES
|
2023-04-03 14:14:17 -07:00
|
|
|
RUN --mount=type=bind,source=.src/packages,target=/build/packages \
|
|
|
|
<<eot
|
2023-04-01 07:17:43 -07:00
|
|
|
echo -e "\n ************************************************* \n"
|
|
|
|
echo "Building Image from Base: $BASE_IMAGE"
|
|
|
|
echo "Distro: $LINUX_DISTRO; *****"
|
|
|
|
echo " ---- running packages install script ---"
|
|
|
|
cd packages; /bin/sh ./packages.sh; cd ..
|
|
|
|
echo -e "\n********************************************************"
|
|
|
|
eot
|
2023-03-22 09:10:54 -07:00
|
|
|
# END PACKAGES
|
2023-01-21 22:22:41 -08:00
|
|
|
|
2023-03-22 09:10:54 -07:00
|
|
|
# INITIALIZATION
|
2023-04-03 14:14:17 -07:00
|
|
|
RUN --mount=type=bind,source=.src/init,target=/build/init \
|
|
|
|
<<eot
|
|
|
|
echo -e "\n ************************************************* \n"
|
|
|
|
echo "****** Initializing Image with build source ******"
|
|
|
|
cd init
|
|
|
|
pwd; ls -la
|
|
|
|
if [[ -d env/ ]]; then
|
|
|
|
echo "copying env/ to /opt/env"
|
|
|
|
/bin/cp -R -p env/. /opt/env
|
|
|
|
ls -la /opt/env
|
|
|
|
fi
|
|
|
|
if [[ -f env/build.env ]]; then
|
|
|
|
source /opt/env/build.env
|
|
|
|
rm -f /opt/env/build.env
|
|
|
|
echo sourced /opt/env/build.env and deleted
|
|
|
|
fi
|
|
|
|
if [[ -d bin/ ]]; then
|
|
|
|
echo "copying bin/ to /opt/bin"
|
|
|
|
/bin/cp -R -p bin/. /opt/bin
|
|
|
|
chmod -R +x /opt/bin
|
|
|
|
ls -la /opt/bin
|
|
|
|
fi
|
|
|
|
echo " ---- running init script init.sh ---"
|
|
|
|
/bin/bash ./init.sh
|
|
|
|
echo "############## Finished run init build script(s) ###########################"
|
|
|
|
if [[ -f /opt/env/run.env ]]; then
|
|
|
|
echo "sourcing /opt/env/run.env from /etc/profile"
|
|
|
|
echo "&&&&&& last 10 of /etc/profile &&&&&"
|
|
|
|
echo -e "# added from image build\nsource /opt/env/run.env" >> /etc/profile
|
|
|
|
tail /etc/profile
|
|
|
|
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
|
|
|
fi
|
2023-03-22 09:10:54 -07:00
|
|
|
echo -e "\n ************* End Initialzation ************************"
|
2023-04-03 14:14:17 -07:00
|
|
|
eot
|
2023-03-22 09:10:54 -07:00
|
|
|
# END INITIALIZATION
|
2022-10-20 18:48:17 -07:00
|
|
|
|
2023-03-25 11:27:22 -07:00
|
|
|
# default command
|
2023-01-22 15:02:36 -08:00
|
|
|
CMD ["/bin/bash", "-l"]
|
2023-03-25 11:27:22 -07:00
|
|
|
# default
|
|
|
|
WORKDIR /opt
|
|
|
|
|
|
|
|
|