Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit fa3672a

Browse files
authored
Add sam/app.yml with ServerlessRepoPublish function (#2)
1 parent 687ce74 commit fa3672a

File tree

4 files changed

+315
-8
lines changed

4 files changed

+315
-8
lines changed

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ PY_VERSION := 3.6
44
export PYTHONUNBUFFERED := 1
55

66
BUILD_DIR := dist
7+
TEMPLATE_DIR := sam
8+
9+
# Required environment variables (user must override)
10+
11+
# S3 bucket used for packaging SAM templates
12+
PACKAGE_BUCKET ?= <bucket>
13+
14+
# user can optionally override the following by setting environment variables with the same names before running make
15+
16+
# Stack name used when deploying the app for manual testing
17+
APP_STACK_NAME ?= aws-serverless-codepipeline-serverlessrepo-publish
718

819
PYTHON := $(shell /usr/bin/which python$(PY_VERSION))
920

@@ -27,6 +38,12 @@ test: compile-app
2738
build: package test
2839

2940
package: compile-app
41+
cp -r $(TEMPLATE_DIR)/app.yml app $(BUILD_DIR)
42+
3043
# package dependencies in lib dir
3144
pipenv lock --requirements > $(BUILD_DIR)/requirements.txt
32-
pipenv run pip install -t $(BUILD_DIR)/app/lib -r $(BUILD_DIR)/requirements.txt
45+
pipenv run pip install -t $(BUILD_DIR)/app/lib -r $(BUILD_DIR)/requirements.txt
46+
47+
deploy: package
48+
pipenv run sam package --template-file $(BUILD_DIR)/app.yml --s3-bucket $(PACKAGE_BUCKET) --output-template-file $(BUILD_DIR)/packaged-app.yml
49+
pipenv run sam deploy --template-file $(BUILD_DIR)/packaged-app.yml --stack-name $(APP_STACK_NAME) --capabilities CAPABILITY_IAM

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pytest = "*"
1111
"flake8" = "*"
1212
pydocstyle = "*"
1313
pytest-cov = "*"
14+
aws-sam-cli = "*"
1415

1516
[requires]
1617
python_version = "3.6"

Pipfile.lock

Lines changed: 281 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)