diff --git a/README.md b/README.md deleted file mode 100644 index d3beac7..0000000 --- a/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Basic-Bootstrap-Php-Ecommerce - -![𝚅𝚒𝚜𝚒𝚝𝚘𝚛𝚜](https://visitor-badge.laobi.icu/badge?page_id=ajayrandhawa.Basic-Bootstrap-Php-Ecommerce&title=Visitor ) - -Basic HTML, BOOTSTRAP, PHP Ecommerce Site. Just Basic Functionality with login, register, product listing, cart management, checkout. It comes with MySql database. - -## Features: - -1. Login -2. Register -3. Product Listing -4. Cart Manage -5. Delivery Address Page -6. CheckOut - - - -Feel Free To Contribute :) diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..22dd3cc --- /dev/null +++ b/dockerfile @@ -0,0 +1 @@ +from wordpress:php7.4 diff --git a/dockerhub.sh b/dockerhub.sh new file mode 100644 index 0000000..3dcddf8 --- /dev/null +++ b/dockerhub.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +USERNAME="raja9658" +PASSWD="Raja@12345" +ORGANIZATIONNAME="raja9658" +REPOSITORY="docker-version" + +# get token to be able to talk to Docker Hub +TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${USERNAME}'" , "password": "'${PASSWD}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) + +#echo ${TOKEN} +echo "Identifying and deleting images first tag in ${ORGANIZATIONNAME} docker hub account" + +# get tags for repo +# you can use jq for search name +IMAGE_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORGANIZATIONNAME}/${REPOSITORY}/tags/ | jq -r '.results|.[]|.name') +echo $IMAGE_TAGS + +FIRST_TAG=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORGANIZATIONNAME}/${REPOSITORY}/tags/ | jq -r '.results|.[7]|.name') +echo "first tag is ${FIRST_TAG}" +## Please uncomment below line to delete docker hub images of docker hub repositories +curl -s -X DELETE -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORGANIZATIONNAME}/${REPOSITORY}/tags/${FIRST_TAG}/ +echo "$?" + +if [ ${FIRST_TAG} = "null" ] + then + echo "first tag is showing null." + echo "you have to push to dockerhub" + else + echo "successfully deleted" +fi + +echo "Script execution end" diff --git a/jkkjk.hjb b/jkkjk.hjb new file mode 100644 index 0000000..43cb4f9 --- /dev/null +++ b/jkkjk.hjb @@ -0,0 +1,46 @@ +#!/bin/bash +#Script will delete all images in all repositories of your docker hub account which are older than 50 days + +set -e + +UNAME= +UPASS= +ORGANIZATIONNAME= +REPOSITORY= + +# get token to be able to talk to Docker Hub +TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) + +echo +echo "Identifying and deleting images which are older than 50 days in ${ORGANIZATIONNAME} docker hub account" + +# get tags for repo +echo +echo "Looping Through ${REPOSITORY} repository in ${UNAME} account" +IMAGE_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORGANIZATIONNAME}/${REPOSITORY}/tags/?'page=2000' | jq -r '.results|.[]|.name') + +# build a list of images from tags +for j in ${IMAGE_TAGS} +do + echo + # add last_updated_time + updated_time=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORGANIZATIONNAME}/${REPOSITORY}/tags/${j}/?page_size=10000 | jq -r '.last_updated') + echo $updated_time + datetime=$updated_time + timeago='50 days ago' + + dtSec=$(date --date "$datetime" +'%s') + taSec=$(date --date "$timeago" +'%s') + + echo "INFO: dtSec=$dtSec, taSec=$taSec" + + if [ $dtSec -lt $taSec ]; then + echo "This image ${UNAME}/${REPOSITORY}:${j} is older than 50 days, deleting this image" + ## Please uncomment below line to delete docker hub images of docker hub repositories + ##curl -s -X DELETE -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORGANIZATIONNAME}/${REPOSITORY}/tags/${j}/ + else + echo "This image ${UNAME}/${REPOSITORY}:${j} is within 50 days time range, keep this image" + fi +done + +echo "Script execution ends"