forked from aws-samples/aws-do-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.env
71 lines (65 loc) · 3.27 KB
/
.env
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
# Source helper functions
source .fun
# Proxy settings [optional] - set if your network requires a proxy to connect to the Internet
export http_proxy=
export https_proxy=
export no_proxy=localhost
# AWS settings
if [ -f ${HOME}/.aws/credentials ]; then
## AWS_PROFILE - name of AWS CLI settings profile to use AWS_PROFILE=default(default)|aws-do-eks|...
export AWS_PROFILE=default
fi
## If no AWS CLI credentials are configured, then the instance profile is in effect
## AWS_REGION - will be set to AWS_DEFAULT_REGION if not set externally.
export AWS_DEFAULT_REGION=us-west-2
if [ "${AWS_REGION}" == "" ]; then
export AWS_REGION=$AWS_DEFAULT_REGION
fi
# Docker image settings
## REGISTRY: [optional] - Docker registry path including trailing "/". Example: registry.company.com/demo/
## If REGISTRY==default, then the default elastic container registry in the account for the current region will be used
export REGISTRY=default
## Set default registry if needed
if [ "$REGISTRY" == "default" ]; then
export REGION=${AWS_REGION}
export ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
if [ "$ACCOUNT" == "" ]; then
export REGISTRY=""
else
export REGISTRY=${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/
fi
fi
## Add trailing forward slash if needed
if [ -n "${REGISTRY}" ]; then
if [ "${REGISTRY: -1}" != "/" ]; then
export REGISTRY="${REGISTRY}/"
fi
fi
## IMAGE: <required> - Docker image name for this project. Example: myapp
export IMAGE=aws-do-eks
## VERSION: [optional] - Version tag for this Docker image. Example: v20180302
#export VERSION=v$(date +%Y%m%d)
export VERSION=v20240601
export TAG=$(if [ -z "${VERSION}" ]; then echo ""; else echo ":${VERSION}"; fi)
## BUILD_OPTS: [optional] - arguments for the docker image build command
export BUILD_OPTS="--progress plain --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}"
# Docker container runtime settings
## CONTAINER_NAME: [optional] - Name of the Docker container including the --name switch. Example --name myapp
export CONTAINER=${IMAGE}
export CONTAINER_NAME="--name ${CONTAINER}"
## Port map [optional] - Mapping of external to internal ports including the -p switch. Example -p 80:8080
#export PORT_MAP="-p 8080:8080"
## Volume map [optional] - Mapping of external to internal paths including the -v switch. Example $(pwd):/wd
export VOL_MAP="-v ${HOME}/.aws:/root/.aws -v ${HOME}/.kube:/root/.kube -v $(pwd):/aws-do-eks -v $(pwd):/wd -v $(pwd)/wd/conf:/eks/conf -v /var/run/docker.sock:/var/run/docker.sock"
## Network [optional] - Network name including the --net switch. Example --net mynet
#export NETWORK=
## RUN_OPTS [optional] - additional options to specify with the run comman. Example -e POSTGRES_DB=dbname
export RUN_OPTS="-e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e REGION=$REGION -e AWS_DEFAULT_REGION=$REGION"
if [ -f ${HOME}/.aws/credentials ]; then
export RUN_OPTS="${RUN_OPTS} -e AWS_PROFILE=$AWS_PROFILE"
fi