This repository has been archived by the owner on Jan 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace deployment with simple docker image test
- Loading branch information
1 parent
3404861
commit 040a93a
Showing
4 changed files
with
43 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
dist: xenial | ||
sudo: required | ||
language: python | ||
services: | ||
- docker | ||
env: | ||
global: | ||
- DOCKER_REPO=ivarprudnikov/rnn-generator | ||
- AWS_ACCOUNT_ID=630017267485 | ||
- EB_REGION="eu-west-1" | ||
- EB_APP="rnn-generator" | ||
- EB_ENV="RnnGenerator-dev"; | ||
- S3_BUCKET="elasticbeanstalk-eu-west-1-630017267485" | ||
- secure: oFCFms3HNKJ6y86SG7Zt02776ihLkICCs28kML6I0Hsi2ZuSarDucjqZMskOsV7yaFjKasbztUa25oC/EWemhUMdFIJN008Vu4r4nTxOmfOzHqt1lvJs60yx9R//kSgqUaZiT5pvqmRFh3V2mzAXy6/DVK4P/H7RQ5teBUaUUyoWSqI52/cWmasIG6+YYl2w0ximP0eTOJYJR3FVxuURKH8P+t3GLAaqxkKv6/jDZG0/ydDZLwE3+cLklB1NSxYJGemAI9367IUXf+s0UFKCTVzmqL/sLKH4vWzgAba2PJFVgq+BCS5MzYuyOkFS6gyrhwOwnhhKzC79tO6AQS49/9oK9ka3P+9YG1MPYSINHIoWuj6Ivm7U3wHoIrAZPm6PAMRz6xUduadlYtPPYxCgC1jNyvRHregQ8EUSkxTewFSLpts7DD1dkr5+AuI4SzSwISGxYMr442pWA9Q9bZ8e2Mpk7iiy9VbOCNnXicQhrfu5xluzPz1ofif40LXoi+XFvybDpZPuU2riGI3WUunUj99VSQVZs7jyiLB4PvxfAYPk/R1H8ebWtpRd7ZwjcEfwA0T63RDTwtLJNiXPu/kQWXYXiEJ02Puf1lr4Bot8pS/bL5O+5j/vW9wKyz6GO0w9w+F0KWcR2WgLVq1D+vh4jCU1h+e0kIukDBFoG0R6IGU= | ||
- secure: uisPRs+nWzc+pUFtc7hCjNdihbMITGglm1sRYbSea1GKl0e2gwovB4oVBNDj49CB+qm31CTxS8jibylKad0qn+Ui3oDG8hJkI1AUKTFSqM8kX+PaP3gILYEQmI/QUV51cHSyxgTVGBZhuW6rJ3uOUfYXdE/NUJVZIQWnDLvANBzs/We/ERG48oiX7mVF06y9454Oz5lKOEh+HOxEwCAYapgyZv3tjD7HuePYAjpvYdfZ5PBTyYqLcB/qd1iAzPcXA+3RpVy1/3ca9/uSxXMllWv56vWauJAkGOjP2TkJx48Qgwks8QEcSHktl4yBw+EPwRte+cnuwgvgpIMuIY3hHwggJRCu5EaaCFmeNhlYxPxuCPVxsv5reg5oe95TVfNlvhdiDh89RAB2wUUSRyvIN3Xv9R9S1eljLrpNL5RcT24jzQRk0r8DxKCT67AH8YxZcZs0u9/WHdnoByn9qEx9SHlA7cLjj+RgRJvi/s3XyVG2l1vT8IuLj3sn0PcpkQe0/pJtv2OuEXT5QEZoXl/rzLZRi7p870pTLQoZpDA3nAlbx4eg9pSEEWW2F/vcXTpOdCdtJ4N6USp7Lw16yjFpTrjNjzxaA29KraKSBGpv9S7gEKYRhv1r+qqP/cjh5V4fWFjN5kp2+jEyiAB5smzpObyuJMcb5kiPeolb+GV6Lg8= | ||
before_install: | ||
- pip install awscli | ||
- export PATH=$PATH:$HOME/.local/bin | ||
script: | ||
- docker build -t $DOCKER_REPO . | ||
deploy: | ||
provider: script | ||
script: bash docker_push.sh | ||
on: | ||
branch: master | ||
- mysql | ||
before_script: mysql -uroot -e 'drop database if exists rnn_generator; create database rnn_generator;' | ||
script: bash testDockerImage.sh |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
DOCKER_DIR=. | ||
DOCKER_TAG=xyz | ||
MYSQL_DB_HOST=localhost | ||
MYSQL_DB_USER=root | ||
MYSQL_DB_PASS= | ||
MYSQL_DB_NAME=rnn_generator | ||
|
||
# build the image | ||
docker build -t ${DOCKER_TAG} ${DOCKER_DIR} | ||
|
||
# run in detached mode | ||
# use host networking to access localhost | ||
IMG=`docker run --rm -d \ | ||
--network="host" \ | ||
-e "MYSQL_HOST=${MYSQL_DB_HOST}" \ | ||
-e "MYSQL_USER=${MYSQL_DB_USER}" \ | ||
-e "MYSQL_PASSWORD=${MYSQL_DB_PASS}" \ | ||
-e "MYSQL_DATABASE=${MYSQL_DB_NAME}" \ | ||
-p 8080:8080 ${DOCKER_TAG}` | ||
|
||
# wait for server to boot | ||
sleep 5; | ||
|
||
# Get server response | ||
RESPONSE=`docker exec -it $IMG bash -c "curl --silent -I localhost:8080 | grep -E '^HTTP' "` | ||
|
||
# Stop image | ||
docker stop $IMG | ||
|
||
# check response code | ||
if [[ $RESPONSE == *200* ]]; then | ||
echo "server responds with status 200" | ||
exit 0 | ||
else | ||
echo "server failed with response $RESPONSE" | ||
exit 1 | ||
fi |