From ab935a5ba3c1ed03d71d1f81cd3460fed5654c21 Mon Sep 17 00:00:00 2001 From: Thomas Gautier Date: Mon, 19 Aug 2024 20:02:05 +0200 Subject: [PATCH] Fix Phoenix App Deployment --- Dockerfile | 2 +- entrypoint.sh | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6371b33a..288e196e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine +FROM elixir:1.7.2-alpine RUN apk add --no-cache curl jq diff --git a/entrypoint.sh b/entrypoint.sh index 6719a6f1..1484544f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -40,7 +40,8 @@ fi if ! flyctl status --app "$app"; then # Backup the original config file since 'flyctl launch' messes up the [build.args] section cp "$config" "$config.bak" - flyctl launch --no-deploy --copy-config --name "$app" --image "$image" --region "$region" --org "$org" + flyctl launch --no-deploy --remote-only --copy-config --name "$app" --image "$image" --region "$region" --org "$org" + flyctl apps create "$app" --org "$org" --verbose # Restore the original config file cp "$config.bak" "$config" fi @@ -48,17 +49,12 @@ if [ -n "$INPUT_SECRETS" ]; then echo $INPUT_SECRETS | tr " " "\n" | flyctl secrets import --app "$app" fi -# Attach postgres cluster to the app if specified. -if [ -n "$INPUT_POSTGRES" ]; then - flyctl postgres attach "$INPUT_POSTGRES" --app "$app" || true -fi - # Trigger the deploy of the new version. echo "Contents of config $config file: " && cat "$config" if [ -n "$INPUT_VM" ]; then - flyctl deploy --config "$config" --app "$app" --regions "$region" --image "$image" --strategy immediate --ha=$INPUT_HA --vm-size "$INPUT_VMSIZE" + flyctl deploy --remote-only --config "$config" --app "$app" --regions "$region" --strategy immediate --ha=$INPUT_HA --vm-size "$INPUT_VMSIZE" else - flyctl deploy --config "$config" --app "$app" --regions "$region" --image "$image" --strategy immediate --ha=$INPUT_HA --vm-cpu-kind "$INPUT_CPUKIND" --vm-cpus $INPUT_CPU --vm-memory "$INPUT_MEMORY" + flyctl deploy --remote-only --config "$config" --app "$app" --regions "$region" --strategy immediate --ha=$INPUT_HA --vm-cpu-kind "$INPUT_CPUKIND" --vm-cpus $INPUT_CPU --vm-memory "$INPUT_MEMORY" fi # Make some info available to the GitHub workflow.