mirror of
https://github.com/sartography/cr-connect-db.git
synced 2025-01-24 05:38:56 +00:00
Merge pull request #6 from sartography/chore/github_branches_to_docker_tags
Chore/GitHub branches to docker tags
This commit is contained in:
commit
d72274b29b
@ -1,6 +1,5 @@
|
|||||||
FROM postgres
|
FROM postgres
|
||||||
ARG GIT_COMMIT=""
|
ARG GIT_COMMIT=""
|
||||||
RUN echo "GIT_COMMIT = ${GIT_COMMIT}"
|
CMD echo 'echo "git commit = ${GIT_COMMIT}"' >> ./initdb.sh
|
||||||
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
|
||||||
|
12
deploy.sh
12
deploy.sh
@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Build and push Docker image to Docker Hub
|
# Build and push Docker image to Docker Hub
|
||||||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
|
||||||
APP="db"
|
APP="db"
|
||||||
REPO="sartography/cr-connect-$APP"
|
REPO="sartography/cr-connect-$APP"
|
||||||
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi)
|
TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo "$TRAVIS_BRANCH" ; fi)
|
||||||
COMMIT=${TRAVIS_COMMIT::8}
|
COMMIT=${TRAVIS_COMMIT::8}
|
||||||
|
|
||||||
docker build -f Dockerfile -t "$REPO:$COMMIT" --build-arg GIT_COMMIT="$REPO:$COMMIT" .
|
docker build -f Dockerfile -t "$REPO:$COMMIT" --build-arg GIT_COMMIT="$REPO:$COMMIT" . || exit 1
|
||||||
docker tag "$REPO:$COMMIT" "$REPO:$TAG"
|
docker tag "$REPO:$COMMIT" "$REPO:$TAG" || exit 1
|
||||||
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER"
|
docker tag "$REPO:$COMMIT" "$REPO:travis-$TRAVIS_BUILD_NUMBER" || exit 1
|
||||||
docker push "$REPO"
|
docker push "$REPO" || exit 1
|
||||||
|
|
||||||
# Wait for Docker Hub
|
# Wait for Docker Hub
|
||||||
echo "Publishing to Docker Hub..."
|
echo "Publishing to Docker Hub..."
|
||||||
@ -18,4 +18,4 @@ sleep 30
|
|||||||
|
|
||||||
# Notify UVA DCOS that Docker image has been updated
|
# Notify UVA DCOS that Docker image has been updated
|
||||||
echo "Refreshing DC/OS..."
|
echo "Refreshing DC/OS..."
|
||||||
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$TRAVIS_BRANCH/$APP"
|
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "crconnect/$TRAVIS_BRANCH/$APP" || exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user