#!/bin/bash

DOCKER_CONFIG_DIRECTORY="/home/jonathan/.dotfiles/docker/web/"

if [ ! -z "$1" ]; then

	version="$1"

	if [ "$(whoami)" == "root" ]; then
		cd "$DOCKER_CONFIG_DIRECTORY"
		docker-compose down
		sed "s/%version%/$version/" php/Dockerfile.sample > php/Dockerfile
		docker-compose up --build -d
	else
		gksudo $0 "$version"
	fi
else
	version="$(echo -e "5.6\n7.0\n7.1\n7.2\n7.3" | rofi -dmenu -p "PHP Version")"
	$0 "$version"
fi
