diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..e9a1878ce --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +language: node_js +node_js: + - "10" +services: + - docker +cache: + yarn: true + directories: + - node_modules + +install: + - docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT -t humanconnection/nitro-backend . + +script: + # TODO: re-add when testing is setup properly + # - docker run humanconnection/nitro-backend yarn run db:seed + +after_success: + # - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh + # - chmod +x send.sh + # - ./send.sh success $WEBHOOK_URL + - if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_EVENT_TYPE == "push" ]; then + docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; + docker tag humanconnection/nitro-backend humanconnection/nitro-backend:latest; + docker push humanconnection/nitro-backend:latest; + fi + +after_failure: + - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh + - chmod +x send.sh + - ./send.sh failure $WEBHOOK_URL diff --git a/Dockerfile b/Dockerfile index 5e3f8c650..269b74ea5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,19 @@ FROM node:10-alpine -LABEL Description="Server part of the social network Human Connection" Vendor="Human-Connection gGmbH" Version="0.0.1" Maintainer="Human-Connection gGmbH (developer@human-connection.org)" +LABEL Description="Backend of the Social Network Human-Connection.org" Vendor="Human Connection gGmbH" Version="0.0.1" Maintainer="Human Connection gGmbH (developer@human-connection.org)" -# expose the app port +# Expose the app port EXPOSE 4000 -ARG WORKDIR=/backend - +ARG WORKDIR=/nitro-backend RUN mkdir -p $WORKDIR WORKDIR $WORKDIR +# Install the Application Dependencies COPY package.json . COPY yarn.lock . RUN yarn install --production=false --frozen-lockfile --non-interactive COPY . . +COPY .env.template .env CMD ["yarn", "run", "start"] diff --git a/docker-compose.yml b/docker-compose.yml index af63a3b56..71ea7355c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: backend: - image: humanconnection/backend:latest + image: humanconnection/nitro-backend:latest build: . networks: - hc-network diff --git a/kubernetes/backend-deployment.yaml b/kubernetes/backend-deployment.yaml index 95613f3ac..f75920f0d 100644 --- a/kubernetes/backend-deployment.yaml +++ b/kubernetes/backend-deployment.yaml @@ -31,7 +31,7 @@ spec: value: "false" - name: NEO4J_URI value: bolt://neo4j:7687 - image: humanconnection/backend:latest + image: humanconnection/nitro-backend:latest name: backend ports: - containerPort: 4000 diff --git a/package.json b/package.json index 268f2e1a7..8d5705641 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "GraphQL Backend for Human Connection", "main": "src/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "echo \"Error: no test specified\" && exit 0", "start": "./node_modules/.bin/nodemon --exec babel-node src/index.js", "start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js", "db:seed": "concurrently --kill-others --success first 'cross-env GRAPHQL_URI=http://localhost:4001 PERMISSIONS=disabled GRAPHQL_PORT=4001 yarn run start' 'wait-on tcp:4001 && cross-env GRAPHQL_URI=http://localhost:4001 ./node_modules/.bin/babel-node src/seed/seed-db.js'"