iflrandevu/docker/build/docker.sh

46 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# 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"
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
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