generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildspec.yml
36 lines (34 loc) · 1.28 KB
/
buildspec.yml
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
version: 0.2
# Trigger build #1
env:
variables:
SERVICE_NAME: regtech-mail-api
CONTACTS_SECRET: cfpb/team/regtech/contact-info
IMAGE_SCANNER_SECRET: cfpb/team/regtech/image-scanner-creds
SMTP_CREDS_SECRET: cfpb/team/regtech/smtp-ses-creds
secrets-manager:
EMAIL_TO: "${CONTACTS_SECRET}:developers_all"
IMAGE_SCANNER_URL: "${IMAGE_SCANNER_SECRET}:url"
IMAGE_SCANNER_USERNAME: "${IMAGE_SCANNER_SECRET}:username"
IMAGE_SCANNER_PASSWORD: "${IMAGE_SCANNER_SECRET}:password"
SMTP_HOST: "${SMTP_CREDS_SECRET}:mail_server"
SMTP_PORT: "${SMTP_CREDS_SECRET}:smtp_port"
SMTP_USERNAME: "${SMTP_CREDS_SECRET}:username"
SMTP_PASSWORD: "${SMTP_CREDS_SECRET}:password"
phases:
install:
commands:
- codebuild-init && source ./env.sh
pre_build:
commands:
# Set envvars dependent on CodeBuild project's own envvars
- export IMAGE_NAME="cfpb/${NAMESPACE}/${SERVICE_NAME}"
- export IMAGE_TAG=$GIT_REF
- export REGISTRY_IMAGE_NAME="${ECR_ACCOUNT_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"
- env | sort
build:
commands:
- docker build -t $REGISTRY_IMAGE_NAME .
- scan-image $REGISTRY_IMAGE_NAME $EMAIL_TO
- docker push $REGISTRY_IMAGE_NAME
- echo "Image ${REGISTRY_IMAGE_NAME} now available for use. Enjoy!"