mirror of
https://github.com/sartography/cr-connect-db.git
synced 2025-02-18 17:57:11 +00:00
Merge pull request #1 from sartography/chore/github_branches_to_docker_tags
Chore/GitHub branches to docker tags
This commit is contained in:
commit
7f0d7b3b2d
18
.travis.yml
18
.travis.yml
@ -3,16 +3,22 @@ language: bash
|
|||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
before_install:
|
env:
|
||||||
|
global:
|
||||||
|
- COMMIT=${TRAVIS_COMMIT::8}
|
||||||
|
|
||||||
|
install:
|
||||||
- sudo pip install --upgrade pip
|
- sudo pip install --upgrade pip
|
||||||
- pip install --user awscli
|
- pip install --user awscli
|
||||||
- export PATH=$PATH:$HOME/.local/bin
|
- export PATH=$PATH:$HOME/.local/bin
|
||||||
- echo $DOCKER_TOKEN | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
||||||
|
|
||||||
install:
|
deploy:
|
||||||
docker build --no-cache -t sartography/cr-connect-db:latest . || exit 1;
|
provider: script
|
||||||
docker push sartography/cr-connect-db:latest || exit 1;
|
script: bash deploy.sh
|
||||||
aws sqs send-message --region 'us-east-1' --queue-url 'https://queue.amazonaws.com/474683445819/dcos-refresh' --message-body 'crconnect/db' || exit 1;
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
all_branches: true
|
||||||
|
condition: $TRAVIS_BRANCH =~ ^(testing|staging|master)$
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
FROM postgres
|
FROM postgres
|
||||||
|
ARG GIT_COMMIT=unspecified
|
||||||
|
LABEL git_commit=$GIT_COMMIT
|
||||||
COPY ./initdb.sh /docker-entrypoint-initdb.d/initdb.sh
|
COPY ./initdb.sh /docker-entrypoint-initdb.d/initdb.sh
|
||||||
|
CMD echo 'echo "git commit = $GIT_COMMIT"' >> /docker-entrypoint-initdb.d/initdb.sh
|
||||||
EXPOSE 5432
|
EXPOSE 5432
|
||||||
|
19
deploy.sh
Normal file
19
deploy.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Build and push Docker image to Docker Hub
|
||||||
|
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
APP="db"
|
||||||
|
REPO="sartography/cr-connect-$APP";
|
||||||
|
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi;)
|
||||||
|
docker build --build-arg GIT_COMMIT="$REPO:$COMMIT" -f Dockerfile -t "$REPO:$COMMIT" .;
|
||||||
|
docker tag "$REPO:$COMMIT" "$REPO:$TAG";
|
||||||
|
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER";
|
||||||
|
docker push "$REPO";
|
||||||
|
|
||||||
|
# Wait for Docker Hub
|
||||||
|
echo "Publishing to Docker Hub..."
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
# Notify UVA DCOS that Docker image has been updated
|
||||||
|
echo "Refreshing DC/OS..."
|
||||||
|
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$TRAVIS_BRANCH/$APP";
|
Loading…
x
Reference in New Issue
Block a user