-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adb5c74
commit 4e8febc
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
stages: | ||
- build | ||
- dockerbuild | ||
- publish | ||
- deploy | ||
|
||
cache: | ||
paths: | ||
- dist | ||
- node_modules | ||
|
||
build:frontend: | ||
image: node:6 | ||
stage: build | ||
before_script: | ||
- npm install -g typescript webpack | ||
- npm install | ||
script: | ||
- webpack | ||
|
||
dockerbuild:frontend: | ||
image: docker:17.04.0-ce | ||
stage: dockerbuild | ||
dependencies: | ||
- build:frontend | ||
script: | ||
- docker image build -t myevents/frontend:$CI_COMMIT_REF_NAME . | ||
only: | ||
- tags | ||
|
||
publish: | ||
image: docker:17.04.0-ce | ||
stage: publish | ||
dependencies: | ||
- dockerbuild:frontend | ||
before_script: | ||
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | ||
script: | ||
- docker image push myevents/frontend:$CI_COMMIT_REF_NAME | ||
only: | ||
- tags | ||
|
||
deploy: | ||
image: alpine:3.5 | ||
stage: deploy | ||
environment: production | ||
before_script: | ||
- apk add --update openssl | ||
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl | ||
- echo "$KUBE_CA_CERT" > ca.crt | ||
- kubectl config set-credentials gitlab-ci --token="${KUBE_TOKEN}" | ||
- kubectl config set-cluster your-cluster --server=https://your-cluster.example --certificate-authority=ca.crt | ||
- kubectl config set-context your-cluster --cluster=your-cluster --user=gitlab-ci | ||
- kubectl config use-context your-cluster | ||
script: | ||
- kubectl set image deployment/eventservice api=myevents/frontend:${CI_COMMIT_REF_NAME} | ||
only: | ||
- tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
sudo: required | ||
language: node | ||
services: | ||
- docker | ||
node_js: | ||
- 6 | ||
env: | ||
- SERVICE=frontend | ||
- CGO_ENABLED=0 | ||
- DOCKER_USER=<your-dockerhub-user> | ||
|
||
install: | ||
- npm install | ||
- npm install -g typescript webpack | ||
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/linux/amd64/kubectl | ||
- chmod +x kubectl | ||
- echo "${KUBE_CA_CERT}" > ca.crt | ||
- ./kubectl config set-credentials travis-ci --token="${KUBE_TOKEN}" | ||
- ./kubectl config set-cluster your-cluster --server=https://your-cluster.example --certificate-authority=ca.crt | ||
- ./kubectl config set-context your-cluster --cluster=your-cluster --user=travis-ci --namespace=default | ||
- ./kubectl config use-context your-cluster | ||
script: | ||
- webpack | ||
- docker image build -t ${DOCKER_USER}/myevents_${SERVICE}:${TRAVIS_BRANCH} src/${SERVICE} | ||
|
||
after_success: | ||
- if [ -n "${TRAVIS_TAG}" ] ; then | ||
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"; | ||
docker push ${DOCKER_USER}/myevents_${SERVICE}:${TRAVIS_BRANCH}; | ||
./kubectl set image deployment/${SERVICE} frontend=${DOCKER_USER}/myevents_${SERVICE}:${TRAVIS_BRANCH} | ||
fi |