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/plato/html
/docker/mysql/*
/docker/build/output/*
/docker/build/iflrandevu-*
!/docker/mysql/.gitkeep
/node_modules/
/npm-debug.log

View file

@ -1,46 +1,63 @@
#!/bin/bash
# Docker commands to build iflrandevu
# First setup docker and install alpine image
# Approximately 10min (tested with 4vcpu / 8GB RAM / 30Mbps network speed)
# Docker commands (will be converted to dockerfile)
if [[ $(pwd) != *iflrandevu/docker/build ]]; then
echo "PLEASE CHANGE DIRECTORY TO \`iflrandevu/docker/build\` BEFORE STARTING SCRIPT"
exit
fi
docker rm IFLRANDEVU_BUILDER
docker run -it -d --name IFLRANDEVU_BUILDER --mount type=bind,source=".",target=/link/ alpine:latest "/bin/sh"
docker attach IFLRANDEVU_BUILDER --detach-keys="ctrl-k"
if [[ 1 -eq 1 ]]; then
echo "RUN COMMANDS IN ALPINE DOCKER"
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
echo "PLEASE CHANGE DIRECTORY TO \`iflrandevu/docker/build\` BEFORE STARTING SCRIPT"
exit
fi
docker rm IFLRANDEVU_BUILDER
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"
exit
elif [[ $1 == "docker" ]]; then
set -ex
# Inside Alpine Docker
apk update && apk upgrade
apk add git npm composer
apk add php-gd php-dom php-xml php-xmlwriter phpunit
mkdir /docker_build/
cd /docker_build/
git clone https://git.aliberksandikci.com.tr/ifl/iflrandevu
cd iflrandevu
composer update
composer upgrade
npm audit fix # maybe no need ?
npm install && composer install
npm run build
apk add zip
echo "DELETING OLD BUILD FILE!!! (after waiting 30 sec)"
sleep 30
mkdir -p /link/output/
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/
zip -r "/link/iflrandevu-$IFLRANDEVU_VER.zip" ./*
sleep 5
echo "BYE!"
exit
fi
# Inside Alpine Docker
apk update && apk upgrade
apk add git npm composer
apk add php-gd php-dom php-xml php-xmlwriter phpunit
echo "EXIT"
mkdir /docker_build/
cd /docker_build/
git clone https://git.aliberksandikci.com.tr/ifl/iflrandevu
cd iflrandevu
composer update
composer upgrade
npm audit fix # maybe no need ?
npm install && composer install
npm run build
apk add zip
echo "DELETING OLD BUILD FILE!!! (after waiting 30 sec)"
sleep 30
mkdir -p /link/output/
rm /link/output/IFLRANDEVU_BUILD_OUTPUT_LATEST.zip
cd /docker_build/iflrandevu/build/
zip -r /link/output/IFLRANDEVU_BUILD_OUTPUT_LATEST.zip ./*
sleep 5
echo "BYE!"
exit
# TODO run itself
# TODO dockerfile
# TODO convert to dockerfile