Merge pull request #41 from sartography/dev
Disables AWS SQS message to refresh DCOS
This commit is contained in:
commit
03aa64ac84
|
@ -7,9 +7,6 @@ language: node_js
|
|||
node_js:
|
||||
- 12
|
||||
|
||||
python:
|
||||
- "3.7"
|
||||
|
||||
services:
|
||||
- docker
|
||||
- xvfb
|
||||
|
@ -33,6 +30,7 @@ env:
|
|||
global:
|
||||
- API_URL=http://localhost:5000/v1.0
|
||||
- BASE_HREF=/
|
||||
- DEPLOY_URL=/
|
||||
- HOME_ROUTE=home
|
||||
- IRB_URL=http://localhost:5001/
|
||||
- PORT0=4200
|
||||
|
@ -42,7 +40,7 @@ script:
|
|||
|
||||
deploy:
|
||||
provider: script
|
||||
script: bash ./deploy.sh
|
||||
script: bash ./deploy.sh sartography/cr-connect-bpmn
|
||||
on:
|
||||
all_branches: true
|
||||
condition: $TRAVIS_BRANCH =~ ^(dev|testing|demo|training|staging|master|rrt\/.*)$
|
||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -1,13 +1,7 @@
|
|||
### STAGE 1: Build ###
|
||||
FROM node AS builder
|
||||
FROM sartography/cr-connect-angular-base AS builder
|
||||
|
||||
RUN mkdir /crc-bpmn
|
||||
WORKDIR /crc-bpmn
|
||||
|
||||
ADD package.json /crc-bpmn/
|
||||
ADD package-lock.json /crc-bpmn/
|
||||
|
||||
COPY . /crc-bpmn/
|
||||
COPY . /app/
|
||||
|
||||
ARG build_config=prod
|
||||
RUN npm install && \
|
||||
|
@ -17,8 +11,8 @@ RUN npm install && \
|
|||
FROM nginx:alpine
|
||||
RUN set -x && apk add --update --no-cache bash libintl gettext curl
|
||||
|
||||
COPY --from=builder /crc-bpmn/dist/* /etc/nginx/html/
|
||||
COPY --from=builder /crc-bpmn/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=builder /app/dist/* /etc/nginx/html/
|
||||
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Script for substituting environment variables
|
||||
COPY ./docker/substitute-env-variables.sh ./entrypoint.sh
|
||||
|
|
51
deploy.sh
51
deploy.sh
|
@ -1,48 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Install AWS CLI
|
||||
pip install --user awscli;
|
||||
export PATH=$PATH:$HOME/.local/bin;
|
||||
#########################################################################
|
||||
# Builds the Docker image for the current git branch on Travis CI and
|
||||
# publishes it to Docker Hub.
|
||||
#
|
||||
# Parameters:
|
||||
# $1: Docker Hub repository to publish to
|
||||
#
|
||||
# Required environment variables (place in Settings menu on Travis CI):
|
||||
# $DOCKER_USERNAME: Docker Hub username
|
||||
# $DOCKER_TOKEN: Docker Hub access token
|
||||
#########################################################################
|
||||
|
||||
echo 'Building Docker image...'
|
||||
DOCKER_REPO="$1"
|
||||
|
||||
function branch_to_tag () {
|
||||
if [ "$1" == "latest" ]; then echo "production"; else echo "$1" ; fi
|
||||
if [ "$1" == "master" ]; then echo "latest"; else echo "$1" ; fi
|
||||
}
|
||||
|
||||
function branch_to_deploy_group() {
|
||||
if [[ $1 =~ ^(rrt\/.*)$ ]]; then echo "rrt"; else echo "crconnect" ; fi
|
||||
}
|
||||
|
||||
function branch_to_deploy_stage () {
|
||||
if [ "$1" == "master" ]; then echo "production"; else echo "$1" ; fi
|
||||
}
|
||||
DOCKER_TAG=$(branch_to_tag "$TRAVIS_BRANCH")
|
||||
|
||||
REPO="sartography/cr-connect-bpmn"
|
||||
TAG=$(branch_to_tag "$TRAVIS_BRANCH")
|
||||
|
||||
DEPLOY_APP="bpmn"
|
||||
DEPLOY_GROUP=$(branch_to_deploy_group "$TRAVIS_BRANCH")
|
||||
DEPLOY_STAGE=$(branch_to_deploy_stage "$TRAVIS_BRANCH")
|
||||
|
||||
if [ "$DEPLOY_GROUP" == "rrt" ]; then
|
||||
IFS='/' read -ra ARR <<< "$TRAVIS_BRANCH" # Split branch on '/' character
|
||||
TAG=$(branch_to_tag "rrt_${ARR[1]}")
|
||||
DEPLOY_STAGE=$(branch_to_deploy_stage "${ARR[1]}")
|
||||
DOCKER_TAG=$(branch_to_tag "rrt_${ARR[1]}")
|
||||
fi
|
||||
|
||||
DEPLOY_PATH="$DEPLOY_GROUP/$DEPLOY_STAGE/$DEPLOY_APP"
|
||||
echo "REPO = $REPO"
|
||||
echo "TAG = $TAG"
|
||||
echo "DEPLOY_PATH = $DEPLOY_PATH"
|
||||
echo "DOCKER_REPO = $DOCKER_REPO"
|
||||
echo "DOCKER_TAG = $DOCKER_TAG"
|
||||
|
||||
# Build and push Docker image to Docker Hub
|
||||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
|
||||
docker build -f Dockerfile -t "$REPO:$TAG" . || exit 1
|
||||
docker push "$REPO" || exit 1
|
||||
docker build -f Dockerfile -t "$DOCKER_REPO:$DOCKER_TAG" . || exit 1
|
||||
|
||||
# Wait for Docker Hub
|
||||
|
||||
# Push Docker image to 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 "$DEPLOY_PATH" || exit 1
|
||||
docker push "$DOCKER_REPO" || exit 1
|
||||
echo "Done."
|
||||
|
|
Loading…
Reference in New Issue