[Significant Changes] Added build_command.sh to simplify the .gitlab-ci.yml. Added LOG_FILE variable to make the enrypoing 'tail -f' command more useful.
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
variables:
|
||||||
|
LATEST_VER: "22.04"
|
||||||
|
|
||||||
build_22:
|
build_22:
|
||||||
variables:
|
variables:
|
||||||
UBUNTU_VER: "22.04"
|
UBUNTU_VER: "22.04"
|
||||||
|
|||||||
@@ -27,4 +27,6 @@ RUN locale-gen en_US.UTF-8
|
|||||||
|
|
||||||
COPY scripts/entrypoint.sh /entrypoint.sh
|
COPY scripts/entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
ENV LOG_FILE /dev/null
|
||||||
|
|
||||||
CMD [ "/entrypoint.sh" ]
|
CMD [ "/entrypoint.sh" ]
|
||||||
|
|||||||
32
build_command.sh
Normal file
32
build_command.sh
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -x
|
||||||
|
|
||||||
|
export BUILDER_NAME=`docker buildx create --use`
|
||||||
|
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
|
||||||
|
# Following only adds the :latest tag if it is the latest LTS version.
|
||||||
|
if [ "$LATEST_VER" = "$UBUNTU_VER" ];
|
||||||
|
then
|
||||||
|
docker buildx build . \
|
||||||
|
-f Dockerfile \
|
||||||
|
--build-arg UBUNTU_VER=$UBUNTU_VER \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:ubuntu-$UBUNTU_VER:`date "+%Y-%m-%d"` \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:ubuntu-$UBUNTU_VER:latest \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:$UBUNTU_VER \
|
||||||
|
--platform $PLATFORMS \
|
||||||
|
--push --provenance false
|
||||||
|
else
|
||||||
|
docker buildx build . \
|
||||||
|
-f Dockerfile \
|
||||||
|
--build-arg UBUNTU_VER=$UBUNTU_VER \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:ubuntu-$UBUNTU_VER:`date "+%Y-%m-%d"` \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:ubuntu-$UBUNTU_VER:latest \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:$UBUNTU_VER \
|
||||||
|
-t $CI_REGISTRY/docker/$CI_PROJECT_NAME:latest \
|
||||||
|
--platform $PLATFORMS \
|
||||||
|
--push --provenance false
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker buildx prune --builder $BUILDER_NAME -f
|
||||||
|
docker buildx stop $BUILDER_NAME
|
||||||
|
docker buildx rm $BUILDER_NAME
|
||||||
@@ -8,6 +8,8 @@ term_handler() {
|
|||||||
|
|
||||||
trap 'kill ${!}; term_handler' SIGTERM
|
trap 'kill ${!}; term_handler' SIGTERM
|
||||||
|
|
||||||
|
touch $LOG_FILE
|
||||||
|
|
||||||
$USER_COMMAND_INIT &
|
$USER_COMMAND_INIT &
|
||||||
|
|
||||||
tail -f /dev/null & wait ${!}
|
tail -f $LOG_FILE & wait ${!}
|
||||||
|
|||||||
Reference in New Issue
Block a user