37 lines
1.5 KiB
YAML
37 lines
1.5 KiB
YAML
# --------------------------------------------------------------------------------
|
|
# Include for all environments
|
|
#---------------------------------------------------------------------------------
|
|
|
|
.setenv:
|
|
tags:
|
|
- aws-app-common-fast
|
|
script: |
|
|
echo "--- Check AWS IAM assumed role ----"
|
|
aws sts get-caller-identity
|
|
echo "export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" > .awsenv.sh
|
|
echo "export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> .awsenv.sh
|
|
echo "export AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" >> .awsenv.sh
|
|
echo "export VAULT_TOKEN=$VAULT_TOKEN" >> .awsenv.sh
|
|
artifacts:
|
|
paths:
|
|
- .awsenv.sh
|
|
expire_in: 5 mins
|
|
# ---------------------------------
|
|
# Build Docker reverse proxy image
|
|
# ---------------------------------
|
|
.build_image:
|
|
tags:
|
|
- aws-image-builder-fast
|
|
stage: build
|
|
script: |
|
|
source ./.awsenv.sh
|
|
echo "################### Running image builder pipeline."
|
|
/kaniko/executor version
|
|
for image in $(ls ${SRC_FOLDER})
|
|
do
|
|
echo "################### Building image ${image}..."
|
|
KANIKOPROXYBUILDARGS="--force --build-arg http_proxy=${HTTP_PROXY} --build-arg https_proxy=${HTTPS_PROXY} --build-arg no_proxy=${NO_PROXY} --build-arg ENV=${CI_ENVIRONMENT_NAME} --cache=true --single-snapshot --compressed-caching=true"
|
|
# build image
|
|
/kaniko/executor $KANIKOPROXYBUILDARGS --context ./src/${image} --dockerfile ./src/${image}/Dockerfile --destination ${ECR_REGISTRY}/${APPNAME}-${image}:${IMAGE_TAG}
|
|
done
|
|
timeout: 3h
|