Skip to content

Commit

Permalink
Merge pull request #4 from solocommand/locale-cicd
Browse files Browse the repository at this point in the history
Update CI/CD implementation
  • Loading branch information
zarathustra323 authored Jun 12, 2019
2 parents e6f0457 + 5299d3b commit d5cac7b
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 83 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
name: GraphQL Service
script: scripts/deploy.js graphql

- stage: deploy
name: Locale Service
script: scripts/deploy.js locale

- stage: deploy
name: Mailer Service
script: scripts/deploy.js mailer
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:10.15
WORKDIR /identity-x
ENV NODE_ENV production
ARG SERVICE

ADD package.json yarn.lock /identity-x/
ADD packages /identity-x/packages
ADD services/$SERVICE /identity-x/services/$SERVICE
RUN yarn --production --pure-lockfile

WORKDIR /identity-x/services/$SERVICE
ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ]
2 changes: 1 addition & 1 deletion packages/service-clients/src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const services = [

module.exports = cleanEnv(process.env, services.reduce((o, name) => {
const prop = `${name.toUpperCase()}_SERVICE_URL`;
const validator = nonemptystr({ desc: `The ID|Me ${name} service URL to connect to.` });
const validator = nonemptystr({ desc: `The ID|Me ${name} service URL to connect to.`, default: `http://${name}` });
return { ...o, [prop]: validator };
}, {}));
11 changes: 2 additions & 9 deletions scripts/deploy-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@
set -e
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

mv services ../
mkdir services
mv ../services/$1 services/

cp "services/$1/Dockerfile" Dockerfile
docker build -q -t "$1:$2" --build-arg SERVICE=$1 .

mv ../services/* services/
rm -rf ../services
[[ -f "services/$1/Dockerfile" ]] && cp "services/$1/Dockerfile" Dockerfile
docker build -t "$1:$2" --build-arg SERVICE=$1 .

docker tag "$1:$2" "basecms/identity-x-$1-service:$2"
docker push "basecms/identity-x-$1-service:$2"
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const image = `basecms/identity-x-${service}-service`;
const nrIds = {
application: 238098240,
graphql: 238106643,
locale: 242186677,
mailer: 238106582,
membership: 238106610,
organization: 238106397,
Expand Down
9 changes: 0 additions & 9 deletions services/application/Dockerfile

This file was deleted.

11 changes: 7 additions & 4 deletions services/graphql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM node:10.15
WORKDIR /identity-x
ENV NODE_ENV production
ADD ./ /id-me
WORKDIR /id-me
ARG SERVICE

RUN yarn --production
ADD package.json yarn.lock /identity-x/
ADD packages /identity-x/packages
ADD services/$SERVICE /identity-x/services/$SERVICE
RUN yarn --production --pure-lockfile

WORKDIR /id-me/services/graphql
WORKDIR /identity-x/services/$SERVICE
ENTRYPOINT [ "node", "src/index.js" ]
9 changes: 0 additions & 9 deletions services/locale/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions services/mailer/Dockerfile

This file was deleted.

12 changes: 7 additions & 5 deletions services/manage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM danlynn/ember-cli:3.9.0 as ember
WORKDIR /id-me
COPY package.json yarn.lock /id-me/
COPY ./services/manage /id-me/services/manage/
WORKDIR /identity-x

ADD package.json yarn.lock /identity-x/
ADD packages /identity-x/packages
ADD services/manage /identity-x/services/manage
RUN yarn
WORKDIR /id-me/services/manage
WORKDIR /identity-x/services/manage
RUN ember build --env=production

FROM nginx:alpine
COPY --from=ember /id-me/services/manage/dist /id-me/services/manage/dist
COPY --from=ember /identity-x/services/manage/dist /identity-x/services/manage/dist
COPY ./services/manage/nginx.conf /etc/nginx/conf.d/manage.conf
2 changes: 1 addition & 1 deletion services/manage/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ server {
gunzip on;
listen 80 default_server;
listen [::]:80 default_server;
root /id-me/services/manage/dist;
root /identity-x/services/manage/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
Expand Down
9 changes: 0 additions & 9 deletions services/membership/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions services/organization/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions services/token/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions services/user/Dockerfile

This file was deleted.

0 comments on commit d5cac7b

Please sign in to comment.