This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
65 lines (59 loc) · 2.11 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
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
version: 0.2
# FROM BUILD Specifying docker version in buildspec is deprecated. Using docker 19.03.1 .
phases:
install:
runtime-versions:
docker: 18
# pre_build:
# commands:
# - echo Logging in to Amazon ECR...
# - $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION)
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
# Passing eviroment variables to image. Maybe it is not secure.
- "docker build -t jobparser \
--build-arg JP_DB_USERNAME=$JP_DB_USERNAME \
--build-arg JP_DB_PASSWORD=$JP_DB_PASSWORD \
--build-arg JP_DB_HOST=$JP_DB_HOST \
--build-arg JP_DB_PORT=$JP_DB_PORT \
--build-arg JP_DB_DBNAME=$JP_DB_DBNAME \
--build-arg TELEGRAM_TOKEN=$TELEGRAM_TOKEN ."
# - docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .
# - docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
post_build:
commands:
# todo made push to ECR
- echo Build completed on `date`
- docker run -d --name cname jobparser
# increase test time for more reliability.
- sleep 30
- docker logs cname
- docker stop cname
# - echo Pushing the Docker image...
# - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
- echo Preparing archive for the Lambda function
# - cd my-telegram-bot
- cd ./my-telegram-bot
- mv packages/* ./
- zip -r ./function.zip *
- echo Updating Lambda function
- ls -alt
- aws lambda update-function-code --function-name my-telegram-bot-dev-hello --zip-file fileb://function.zip
artifacts:
files:
- '**/*'
# discard-paths: yes
# base-directory: './'
secondary-artifacts:
MyArtifactidentifier:
files:
- '*'
# discard-paths: yes
# these artifacts are not used anywhere
bot-artifacts:
MyArtifactidentifier:
files:
- 'my-telegram-bot/**/*'
# discard-paths: yes