forked from jgraph/docker-drawio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
55 lines (52 loc) · 2.23 KB
/
.travis.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
env:
global:
# Docker Repository
- REPO=jgraph/drawio
# Compute docker tag
- TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- ALPINE_TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "alpine"; else echo $TRAVIS_BRANCH-alpine ; fi`
sudo: required
services:
- docker
before_install:
# Get draw.io current latest version
- wget https://raw.githubusercontent.com/jgraph/drawio/master/VERSION
- export VERSION=`cat VERSION`
# Compute docker tag again if this branch is the latest
- export TAG=`if [ "$TRAVIS_BRANCH" == "v${VERSION}" ]; then echo "latest"; else echo $TAG ; fi`
- export ALPINE_TAG=`if [ "$TRAVIS_BRANCH" == "v${VERSION}" ]; then echo "alpine"; else echo $ALPINE_TAG ; fi`
jobs:
include:
- stage: Build
env:
- BASE_IMAGE=debian
- HTTP_PORT=32733
- HTTPS_PORT=32734
script:
- docker build -f ${BASE_IMAGE}/Dockerfile -t ${REPO}:${VERSION} ${BASE_IMAGE}/
- docker run --name 'drawio' -d -p ${HTTP_PORT}:8080 -p ${HTTPS_PORT}:8443 ${REPO}:${VERSION}
- sleep 10
- docker logs drawio
- docker exec drawio /bin/bash -c "curl -i http://localhost:8080"
after_success:
- echo "${DOCKER_PASS}" | docker login -u "${DOCKER_USER}" --password-stdin
- docker tag ${REPO}:${VERSION} ${REPO}:$TAG
- docker push ${REPO}:${TAG}
- docker push ${REPO}:${VERSION}
- stage: Build
env:
- BASE_IMAGE=alpine
- HTTP_PORT=32735
- HTTPS_PORT=32736
script:
- docker build -f ${BASE_IMAGE}/Dockerfile -t ${REPO}:${VERSION}-${BASE_IMAGE} ${BASE_IMAGE}/
- docker run --name "drawio-${BASE_IMAGE}" -d -p ${HTTP_PORT}:8080 -p ${HTTPS_PORT}:8443 ${REPO}:${VERSION}-${BASE_IMAGE}
- sleep 10
- docker logs drawio-${BASE_IMAGE}
- docker exec drawio-${BASE_IMAGE} /bin/bash -c "curl -i http://localhost:8080"
after_success:
- echo "${DOCKER_PASS}" | docker login -u "${DOCKER_USER}" --password-stdin
- docker tag ${REPO}:${VERSION}-${BASE_IMAGE} ${REPO}:${ALPINE_TAG}
- docker push ${REPO}:${ALPINE_TAG}
- docker push ${REPO}:${VERSION}-${BASE_IMAGE}
- curl -X POST https://hooks.microbadger.com/images/jgraph/drawio/L1HSeb1zjYXdXe4RIVlHXSkT6Ng=