-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yaml
43 lines (36 loc) · 1.17 KB
/
buildspec.yaml
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
41
42
43
version: 0.2
env:
secrets-manager:
DOCKER_HUB_USERNAME: DockerHubCredentials:DockerHubUsername
DOCKER_HUB_SECRET: DockerHubCredentials:DockerHubSecret
phases:
install:
runtime-versions:
java: corretto21
commands:
- echo "Checking if AWS SAM CLI is installed"
- |
if command -v sam >/dev/null 2>&1; then
echo "AWS SAM CLI is already installed";
sam --version;
else
echo "AWS SAM CLI is not installed, installing now";
pip3 install aws-sam-cli
fi
pre_build:
commands:
# We need to be logged in to Docker Hub to pull images for testcontainers
- echo "Logging in to Docker Hub..."
- echo -n "$DOCKER_HUB_SECRET" | docker login --username $DOCKER_HUB_USERNAME --password-stdin
build:
commands:
- sam build
post_build:
commands:
- sam package --s3-bucket $S3_BUCKET --output-template-file packaged_raw.yaml
# Use timestamp to force update of ApiGatewayCreateDeploymentCustomResource
- BUILD_TIMESTAMP=$(date '+%s')
- envsubst '${BUILD_TIMESTAMP}' < packaged_raw.yaml > packaged.yaml
artifacts:
files:
- packaged.yaml