This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from devcontainers-contrib/releases/automated…
…-feature-generation-serverless.yaml-3565365667 Automated feature generation - serverless.yaml
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Serverless Framework", | ||
"id": "serverless", | ||
"version": "1.1.5", | ||
"description": "Serverless Framework is a widely used open-source IaC tool that allows you to build, and deploy serverless applications on multiple cloud providers.", | ||
"documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/serverless", | ||
"installAfter": [ | ||
"ghcr.io/devcontainers/features/python:latest" | ||
], | ||
"options": { | ||
"version": { | ||
"type": "boolean", | ||
"proposals": [ | ||
"latest" | ||
], | ||
"default": "latest", | ||
"description": "Select the version of Serverless Framework to install." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
#------------------------------------------------------------------------------------------------------------- | ||
# This code was generated by the DevContainers Feature Cookiecutter | ||
# Docs: https://github.com/devcontainers-contrib/features/tree/main/pkgs/feature-template#readme | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
set -e | ||
|
||
# npm version for serverless | ||
SERVERLESS_FRAMEWORK=${VERSION:-"latest"} | ||
|
||
# Clean up | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
if [ "$(id -u)" -ne 0 ]; then | ||
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' | ||
exit 1 | ||
fi | ||
|
||
# Checks if packages are installed and installs them if not | ||
check_packages() { | ||
if ! dpkg -s "$@" >/dev/null 2>&1; then | ||
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||
echo "Running apt-get update..." | ||
apt-get update -y | ||
fi | ||
apt-get -y install --no-install-recommends "$@" | ||
fi | ||
} | ||
|
||
# install node+npm if does not exists | ||
if ! type npm >/dev/null 2>&1; then | ||
echo "Installing node and npm..." | ||
check_packages curl | ||
curl -fsSL https://raw.githubusercontent.com/devcontainers/features/main/src/node/install.sh | $SHELL | ||
export NVM_DIR=/usr/local/share/nvm | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" | ||
fi | ||
|
||
if [ "$SERVERLESS_FRAMEWORK" != "none" ]; then | ||
if [ "$SERVERLESS_FRAMEWORK" = "latest" ]; then | ||
util_command="serverless" | ||
else | ||
util_command="serverless@$SERVERLESS_FRAMEWORK" | ||
fi | ||
npm install -g --omit=dev ${util_command} | ||
fi | ||
|
||
# Clean up | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
echo "Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
source dev-container-features-test-lib | ||
|
||
check "serverless --version" serverless --version | ||
|
||
reportResults |