-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yaml
More file actions
40 lines (36 loc) · 1.29 KB
/
buildspec.yaml
File metadata and controls
40 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
version: 0.2
phases:
install:
runtime-versions:
python: 3.12
commands:
- echo "Installing SAM CLI and chardet..."
- sam --version || pip install aws-sam-cli
- pip install chardet
- echo "Detecting encoding of requirements.txt and converting to UTF-8 if necessary..."
- |
encoding=$(python -c '
import chardet
with open("src/requirements.txt", "rb") as f:
detected = chardet.detect(f.read())
encoding = detected["encoding"]
')
echo "Detected encoding: $encoding"
if [ "$encoding" != "utf-8" ] && [ -n "$encoding" ]; then
iconv -f "$encoding" -t UTF-8 src/requirements.txt -o src/requirements.txt.utf8
mv src/requirements.txt.utf8 src/requirements.txt
fi
pre_build:
commands:
- echo "Running tests... no tests found to run..."
# Uncomment the following line if you have tests
# - python -m unittest discover tests
build:
commands:
- echo "Packaging application..."
- aws cloudformation package --template-file template.yaml --s3-bucket $CODEPIPELINE_BUCKET --s3-prefix $S3_PREFIX --output-template-file packaged.yaml
- sam build --template packaged.yaml --use-container
artifacts:
files:
- packaged.yaml
- .aws-sam/build/