Fix EC2 deployment: use /home/ubuntu directory and add sudo for docker commands
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
f2d884fb79
commit
2011054878
12
.github/workflows/deploy-ec2.yml
vendored
12
.github/workflows/deploy-ec2.yml
vendored
@ -38,10 +38,12 @@ jobs:
|
|||||||
script: |
|
script: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
APP_DIR="${APP_DIR:-/var/www/pdc-poc}"
|
APP_DIR="${APP_DIR:-/home/ubuntu/JUNOHUB}"
|
||||||
|
|
||||||
echo "Using app directory: $APP_DIR"
|
echo "Using app directory: $APP_DIR"
|
||||||
mkdir -p "$APP_DIR"
|
# Create directory with sudo if needed, then ensure ownership
|
||||||
|
sudo mkdir -p "$APP_DIR" || mkdir -p "$APP_DIR"
|
||||||
|
sudo chown -R $USER:$USER "$APP_DIR" || true
|
||||||
cd "$APP_DIR"
|
cd "$APP_DIR"
|
||||||
|
|
||||||
# Initialize git repo if needed
|
# Initialize git repo if needed
|
||||||
@ -72,9 +74,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v docker-compose >/dev/null 2>&1; then
|
if command -v docker-compose >/dev/null 2>&1; then
|
||||||
DC="docker-compose"
|
DC="sudo docker-compose"
|
||||||
elif docker compose version >/dev/null 2>&1; then
|
elif sudo docker compose version >/dev/null 2>&1; then
|
||||||
DC="docker compose"
|
DC="sudo docker compose"
|
||||||
else
|
else
|
||||||
echo "Error: Docker Compose is not installed"
|
echo "Error: Docker Compose is not installed"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user