3 Commits

Author SHA1 Message Date
Kamesh Sampath 0e69cca81a Merge pull request #5 from dejaeghered/main
run as user node . This will be updated to be run as `root` later.
2022-10-06 18:59:00 +05:30
David Dejaeghere c45835df5e run as user node 2022-10-06 15:14:55 +02:00
Kamesh 80aee03ab0 fix: add extra parameters
- site directory
- environment file
2022-07-12 18:50:31 +05:30
4 changed files with 25 additions and 3 deletions
+1
View File
@@ -11,6 +11,7 @@ prepare-buildx: ## Create buildx builder for multi-arch build, if not exists
build-plugin: ## Build plugin image locally
docker build --tag=$(IMAGE):$(shell svu next) -f $(DOCKER_FILE) .
docker tag $(IMAGE):$(shell svu next) $(IMAGE):$(TAG)
push-plugin: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: TAG=$(svu c) make push-extension
docker pull $(IMAGE):$(shell svu c) && echo "Failure: Tag already exists" || docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(shell svu c) --tag=$(IMAGE):$(shell svu c) -f $(DOCKER_FILE) .
+1
View File
@@ -12,6 +12,7 @@ The following settings changes this plugin's behavior.
* `vercel_project_create`: (optional) If true then name of the project specified by __vercel_project_id__ will be created and site will be deployed to that project. Defaults `false`.
* `vercel_environment`: (optional) The vercel environment to deploy. It could be one of `development`, `preview` or `production`. Defaults to `development`
* `vercel_environment_variables`: (optional) An array of __KEY=VALUE__ pair of environment variables will be added to site project at __vercel_environment__ scope.
* `vercel_environment_variable_file`: (optional) An environment variable file, with each line being a __KEY=VALUE__ pairs
* `log_level`: If set to debug enable scripting debug
To use the plugin create a secret file called `secret.local` with following variables,
+1 -3
View File
@@ -8,11 +8,9 @@ RUN apk -Uuv add bash curl ca-certificates jq
RUN npm i --location=global vercel
RUN adduser --system --uid 1001 -G root dev
ADD run.sh /bin/
RUN chmod +x /bin/run.sh
USER dev
USER node
CMD ["/bin/run.sh"]
+22
View File
@@ -16,6 +16,15 @@ then
printf "\n Vercel Environment %s \n" "${VERCEL_ENV}"
fi
if [ -z "${PLUGIN_VERCEL_SITE_DIR}" ];
then
PLUGIN_VERCEL_SITE_DIR=.
fi
printf "\nUsing directory '%s' as site directory\n" "${PLUGIN_VERCEL_SITE_DIR}"
cd "${PLUGIN_VERCEL_SITE_DIR}"
VERCEL_COMMAND+=("vercel" "deploy" "--prebuilt" "-t" "${PLUGIN_VERCEL_TOKEN}")
if [ "${VERCEL_ENV}" == "production" ];
@@ -65,6 +74,19 @@ then
printf " \n Vercel Runtime Env %s \n" "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLES}"
fi
if [ -f "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLE_FILE}" ];
then
printf " \n Loading Environment variable files from %s \n" "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLE_FILE}"
while IFS= read -r l; do
if [ -n "$PLUGIN_VERCEL_ENVIRONMENT_VARIABLES" ];
then
PLUGIN_VERCEL_ENVIRONMENT_VARIABLES="$PLUGIN_VERCEL_ENVIRONMENT_VARIABLES,$l"
else
PLUGIN_VERCEL_ENVIRONMENT_VARIABLES="$l"
fi
done < "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLE_FILE}"
fi
OLDIFS=$IFS
if [ -n "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLES}" ] ;
then