This repository was archived by the owner on Dec 14, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +85
-96
lines changed Expand file tree Collapse file tree 8 files changed +85
-96
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ version : 2
3
+ jobs :
4
+ build :
5
+ working_directory : ~/cp-users-service
6
+ docker :
7
+ - image : nodesource/node:0.10.45
8
+ environment :
9
+ NODE_ENV : testing
10
+ steps :
11
+ - checkout
12
+ - restore_cache :
13
+ key : dependency-cache-{{ checksum "package.json" }}
14
+ - run :
15
+ name : Install Dependencies
16
+ command : npm install
17
+ - save_cache :
18
+ key : dependency-cache-{{ checksum "package.json" }}
19
+ paths :
20
+ - node_modules
21
+ - run :
22
+ name : Tests
23
+ command : npm run test
24
+ deploy :
25
+ working_directory : ~/cp-users-service
26
+ docker :
27
+ - image : golang:1.6.4
28
+ steps :
29
+ - checkout
30
+ - setup_remote_docker
31
+ - run :
32
+ name : Install Docker client
33
+ command : |
34
+ set -x
35
+ VER="17.03.0-ce"
36
+ curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-"$VER".tgz
37
+ tar -xz -C /tmp -f /tmp/docker-"$VER".tgz
38
+ mv /tmp/docker/* /usr/bin
39
+ - run :
40
+ name : Deploy to K8
41
+ command : GIT_SHA1="$CIRCLE_SHA1" GIT_BRANCH="$CIRCLE_BRANCH" ./.circleci/kube.sh
42
+ workflows :
43
+ version : 2
44
+ build-test-and-deploy :
45
+ jobs :
46
+ - build
47
+ - deploy :
48
+ requires :
49
+ - build
50
+ filters :
51
+ branches :
52
+ only :
53
+ - master
54
+ - staging
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ if [ " $GIT_BRANCH " = " master" ]; then
6
+ DEP_VER=latest
7
+ HOST=$PROD_HOST
8
+ echo " $PROD_CA_CERT " | base64 -i --decode > ca.pem
9
+ echo " $PROD_ADMIN_KEY " | base64 -i --decode > admin-key.pem
10
+ echo " $PROD_ADMIN_CERT " | base64 -i --decode > admin.pem
11
+ elif [ " $GIT_BRANCH " = " staging" ]; then
12
+ DEP_VER=staging
13
+ HOST=$STAGING_HOST
14
+ echo " $STAGING_CA_CERT " | base64 -i --decode > ca.pem
15
+ echo " $STAGING_ADMIN_KEY " | base64 -i --decode > admin-key.pem
16
+ echo " $STAGING_ADMIN_CERT " | base64 -i --decode > admin.pem
17
+ else
18
+ exit 0
19
+ fi
20
+ docker build --rm=false --build-arg DEP_VERSION=$DEP_VER -t coderdojo/cp-users-service:" $GIT_SHA1 " .
21
+ docker login -u " $DOCKER_USER " -p " $DOCKER_PASS " -e " $DOCKER_EMAIL "
22
+ docker push coderdojo/cp-users-service:" $GIT_SHA1 "
23
+ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/linux/amd64/kubectl
24
+ chmod +x kubectl
25
+ ./kubectl config set-cluster default-cluster --server=https://" $HOST " --certificate-authority=ca.pem
26
+ ./kubectl config set-credentials default-admin --certificate-authority=ca.pem --client-key=admin-key.pem --client-certificate=admin.pem
27
+ ./kubectl config set-context default-system --cluster=default-cluster --user=default-admin
28
+ ./kubectl config use-context default-system
29
+ ./kubectl patch deployment users -p ' {"spec":{"template":{"spec":{"containers":[{"name":"users","image":"coderdojo/cp-users-service:' " $GIT_SHA1 " ' "}]}}}}'
Original file line number Diff line number Diff line change 1
1
FROM mhart/alpine-node:0.10.48
2
2
MAINTAINER butlerx <
[email protected] >
3
-
3
+ ARG DEP_VERSION=latest
4
4
RUN apk add --update git build-base python postgresql-client && \
5
5
mkdir -p /usr/src/app
6
6
WORKDIR /usr/src/app
7
7
COPY . /usr/src/app/
8
8
RUN npm install && \
9
- rm -rf /root/.npm && \
9
+ npm install cp-translations@$DEP_VERSION && \
10
10
apk del build-base python && \
11
11
rm -rf /tmp/* /root/.npm /root/.node-gyp
12
12
EXPOSE 10303
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments