#!/bin/bash

# reset server_website directory
rm -rf server_website
ssh server rm -rf /home/victor/website
mkdir -p server_website/{minishell,vvsite}

# Build server binary
cd vvsite && cargo leptos build --release
cp -r target/release/vvsite Dockerfile Cargo.toml target/site ../server_website/vvsite


# Build minishell files
cd ../minishell
make -C minishell_src
cp -r ./minishell_src/bin ./Dockerfile ./entrypoint.sh ../server_website/minishell

# Copy to server
cd ..
cp -r ./nginx ./compose.yaml server_website
scp -r server_website server:/home/victor/website

