test: update build files

This commit is contained in:
Aliberk Sandıkçı 2023-12-20 20:20:57 +03:00
parent 5b4660a865
commit 2bc1fe0d34
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
2 changed files with 56 additions and 39 deletions

2
.gitignore vendored
View file

@ -6,7 +6,7 @@
/docs/jsdoc/html /docs/jsdoc/html
/docs/plato/html /docs/plato/html
/docker/mysql/* /docker/mysql/*
/docker/build/output/* /docker/build/iflrandevu-*
!/docker/mysql/.gitkeep !/docker/mysql/.gitkeep
/node_modules/ /node_modules/
/npm-debug.log /npm-debug.log

View file

@ -1,20 +1,27 @@
#!/bin/bash #!/bin/bash
# Docker commands to build iflrandevu
# First setup docker and install alpine image
# Approximately 10min (tested with 4vcpu / 8GB RAM / 30Mbps network speed) # Approximately 10min (tested with 4vcpu / 8GB RAM / 30Mbps network speed)
# Docker commands (will be converted to dockerfile)
IFLRANDEVU_VER="1.4.3-ifl.2" # UPDATE MANUALLY !
_RED='\033[0;31m'
_NC='\033[0m \e[0m' # No Color, No Effect
if [[ $1 != "docker" ]]; then
if [[ $(pwd) != *iflrandevu/docker/build ]]; then if [[ $(pwd) != *iflrandevu/docker/build ]]; then
echo "PLEASE CHANGE DIRECTORY TO \`iflrandevu/docker/build\` BEFORE STARTING SCRIPT" echo "PLEASE CHANGE DIRECTORY TO \`iflrandevu/docker/build\` BEFORE STARTING SCRIPT"
exit exit
fi fi
docker rm IFLRANDEVU_BUILDER docker rm IFLRANDEVU_BUILDER
docker run -it -d --name IFLRANDEVU_BUILDER --mount type=bind,source=".",target=/link/ alpine:latest "/bin/sh" docker run -it -d --name IFLRANDEVU_BUILDER --mount type=bind,source=".",target=/link/ alpine:latest "/bin/sh"
echo -e "RUN COMMANDS IN ALPINE DOCKER"
echo -e "RUN SCRIPT: \`${_RED}apk add bash && bash /link/docker.sh docker${_NC}\`"
docker attach IFLRANDEVU_BUILDER --detach-keys="ctrl-k" docker attach IFLRANDEVU_BUILDER --detach-keys="ctrl-k"
if [[ 1 -eq 1 ]]; then
echo "RUN COMMANDS IN ALPINE DOCKER"
exit exit
fi elif [[ $1 == "docker" ]]; then
set -ex
# Inside Alpine Docker # Inside Alpine Docker
apk update && apk upgrade apk update && apk upgrade
apk add git npm composer apk add git npm composer
@ -35,12 +42,22 @@ apk add zip
echo "DELETING OLD BUILD FILE!!! (after waiting 30 sec)" echo "DELETING OLD BUILD FILE!!! (after waiting 30 sec)"
sleep 30 sleep 30
mkdir -p /link/output/ mkdir -p /link/output/
rm /link/output/IFLRANDEVU_BUILD_OUTPUT_LATEST.zip if [[ -f "/link/iflrandevu-$IFLRANDEVU_VER.zip" ]]; then
echo "THIS VERSION ALREADY EXIST"
sleep 1
echo "DELETING OLD ARCHIVE"
sleep 5
rm "/link/iflrandevu-$IFLRANDEVU_VER.zip"
fi
cd /docker_build/iflrandevu/build/ cd /docker_build/iflrandevu/build/
zip -r /link/output/IFLRANDEVU_BUILD_OUTPUT_LATEST.zip ./* zip -r "/link/iflrandevu-$IFLRANDEVU_VER.zip" ./*
sleep 5 sleep 5
echo "BYE!" echo "BYE!"
exit exit
# TODO run itself fi
# TODO dockerfile
echo "EXIT"
# TODO convert to dockerfile