-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,13 @@ addons: | |
env: | ||
global: | ||
- OWNER=${TRAVIS_REPO_SLUG%/*} | ||
- secure: "GtWCiMPNz3MDDTvXqaVsgZBvlxYRZuTY6sUEhWTL37zJZHgRLlxTCTD27hHZp2P4B6G6KGV/0iEvMYxqzo6jMrzcEnt7TlGetteqI18dhV1dIQGH6uy8Y/PktkK2g2FuJeGV3FRK4+a21v6zzSuUaFa26k97mPapa4LS83XXj7rc13ll23HhhtObVF/a1n3U0Xwe4FkdoxbKlecJUnNujESxFk4xQl4N1tFv15fldDlFq0XWs26eEp3LU/n7wkMzbg9WEqPvDeaYlvir9VpvcYWpVvf8Uz+wpvW1jnE2R6bK1TDv5BNzQwbf2JtN284yZ8I1nwZtOJkc1RUr5wUFxCD0p8tc30sAlKemI385v2t1ccoBYMwH8LHFIUoSXoolHZBsnZeADqpo3a0d8hVFWv4AcxC27Q6SfMCltl0+ogAoQ7wVfkRT++044p415Ar4raEqIkqTm64FaRNMS0v2y5mS2634PMSGMRnK+NBrWz1yFKxsiuPKypIWygtrJ4pyiL2yPBZupnCluEgqva3q6AmMDlNuSUmcTEnCRGB01U2if6/oSEgISH1VK2lsRSxuoG5dFFuezwv90YENh/7pw0/hgge7EOse6OzDsU3uNRWcTuXF7eEBhjM1wBHWHlaAwV9vfHMZX4sHWP4R4CZhPjVEPRz6HPEg1tFCs2EvkuI=" | ||
- COMMIT=${TRAVIS_COMMIT::8} | ||
# GITHUB_TOKEN | ||
- secure: GtWCiMPNz3MDDTvXqaVsgZBvlxYRZuTY6sUEhWTL37zJZHgRLlxTCTD27hHZp2P4B6G6KGV/0iEvMYxqzo6jMrzcEnt7TlGetteqI18dhV1dIQGH6uy8Y/PktkK2g2FuJeGV3FRK4+a21v6zzSuUaFa26k97mPapa4LS83XXj7rc13ll23HhhtObVF/a1n3U0Xwe4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VVLYFXsUApD0AWvEOPejLnfVEGber5cA/Hm3HhqB7M9ja2BFml+oYBLc3mnzjKd/FT3VwWMiijfTJVvr6feFrhSQGiRyBLmaoRNmUSjUsfR0= | ||
# DOCKER_PASSWORD | ||
- secure: S22ffhnZOs1yFdBwJO9+uzy9DB3e7ehLWbj47U1zavsMKMDyDw0lkOIy8PMERFh4roBoM5dG95RIVbfNbrPXQxnY5Og2w7RTTv3eeHGdYzh+34Dppfk8mhEAhn3NL98sOe6is/5sEDvZ2ykPFLvoJmyV15V7Wvtuy1Zx+0lyZ0R0tX6sVJUWDlClHspCuSIKK+iptL5yLu4TtvX9Wks/c3kH6GIXYIJIeC63D+RRhuetbtGKND/RtFkq5IDP9qMZNXUAT/Mb8hrsk9HntFgl79dG2ChvBpDE8/LqjYDBiFTiUAtJfBhC0pVB3WaEwGTU/hWe8WTjl29JIkGcoaeT7+wncJ72lEPJoO60YWSdtWfTlNlUiN27AcxGqk39MDhB5NAbuJpKvcFLMmWFY2uJefrR6XVEXBZ+9yAwzuZmj0GYFOQTuczAqncyj/3BuOEqfIkkQ5BLAS5BUuzSEbHOjwasqbTVcWM1H3cv2ZYATXQQN8KhcZ5c5lxy8eD0NXHKvBFlS3HOXOXn3P6PqGgFHzjL+yyHMvzIXBJY4jEr8FIH16dwbXDqb4gi4lrrCZHDeIhVKsmLSUJjhmiKeP7dWcfUOGMxzLRmqA8r58TXcN3OvBrqNN63nUSG+Wb6XxmzLwE4PrlBy0fTRymG8WXrdE/Z2lglBhc8J3A8ER9c46s= | ||
before_install: | ||
- sudo apt-get -y install python3-pip python3-setuptools | ||
install: | ||
|
@@ -31,19 +37,30 @@ before_script: | |
script: | ||
- python3 tools/build.py | ||
before_deploy: | ||
- git config --local user.name 'bugy' | ||
- git config --local user.email '[email protected]' | ||
- git tag -f 'dev' | ||
- git remote add gh https://${OWNER}:${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git | ||
- git push -f gh dev | ||
- git remote remove gh | ||
- if ! [ "$BEFORE_DEPLOY_RUN" ]; then | ||
export BEFORE_DEPLOY_RUN=1; | ||
|
||
git config --local user.name 'bugy' | ||
git config --local user.email '[email protected]' | ||
git tag -f 'dev' | ||
git remote add gh https://${OWNER}:${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git | ||
git push -f gh dev | ||
git remote remove gh | ||
|
||
fi | ||
deploy: | ||
provider: releases | ||
- provider: releases | ||
name: dev | ||
api_key: $GITHUB_TOKEN | ||
api_key: "$GITHUB_TOKEN" | ||
file: build/script-server.zip | ||
prerelease: true | ||
overwrite: true | ||
skip_cleanup: true | ||
on: | ||
branch: master | ||
branch: master | ||
- provider: script | ||
script: tools/deploy_docker.sh | ||
on: | ||
tags: false | ||
all_branches: true | ||
condition: $TRAVIS_BRANCH =~ ^stable|master$ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM python:3.6 | ||
|
||
COPY build/script-server /app | ||
WORKDIR /app | ||
RUN pip install -r requirements.txt | ||
|
||
EXPOSE 5000 | ||
CMD [ "python3", "launcher.py" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -z "$DOCKER_USER" ] || [ -z "$DOCKER_PASSWORD" ] || [ -z "$TRAVIS_BRANCH" ] || [ -z "$COMMIT" ]; then | ||
echo 'Some environment variables are not set' | ||
exit -1 | ||
fi | ||
|
||
IMAGE_NAME='bugy/script-server' | ||
|
||
unzip -o build/script-server.zip -d build/script-server | ||
|
||
docker build -f tools/Dockerfile -t "$IMAGE_NAME":"$COMMIT" . | ||
|
||
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" | ||
|
||
if [ "$TRAVIS_BRANCH" == "stable" ]; then | ||
docker tag "$IMAGE_NAME":"$COMMIT" "$IMAGE_NAME":latest | ||
elif [ "$TRAVIS_BRANCH" == "master" ]; then | ||
docker tag "$IMAGE_NAME":"$COMMIT" "$IMAGE_NAME":dev | ||
else | ||
docker tag "$IMAGE_NAME":"$COMMIT" "$IMAGE_NAME":"$TRAVIS_BRANCH" | ||
fi | ||
|
||
docker push "$IMAGE_NAME" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bugy
Author
Owner
|
Hi @bugy !
In fact here you push ONLY
:latest
tag. asdocker push somename
equivalent todocker push somename:latest
Also, why you avoid using github tags ? I thing it better then push images tagged with commit SHA1.
Let say you have such structure in docker hub:
bugy/script-server:1.13.0
,bugy/script-server:latest
- release 1.13.0 (and it's latest release, so image tagged aslatest
too)bugy/script-server:1.12.0
- release 1.12.0bugy/script-server:1.11.0
- release 1.11.0bugy/script-server:dev
- dev version (built from master branch on each commit)