#!/bin/bash

set -e


name=organia-frontend
pushd $name
	podman build . -t $name
	rm -rf dist
	mkdir -p dist
	podman rm -f $name || echo Nothing to remove
	podman run --rm --name $name \
		-e NODE_OPTIONS=--openssl-legacy-provider \
		-e VUE_APP_API_REMOTE_URL=http://organia.savatier.fr/api/ \
		-e VUE_APP_WEBSOCKET_REMOTE_URL=ws://organia.savatier.fr/api/chats/ws/ \
		-v ./dist:/app/dist:z \
		$name
popd

name=organia-server
pushd $name
	podman build . -t $name
	podman rm -f $name || echo Nothing to remove
	podman run --rm --name $name -d -p 10080:80 -e NO_RELOAD=true $name
	podman logs -f $name
popd
