Skip to content
Open

Dev #20

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
name: CICD
name: CICD-PIPELINE

on:
push:
branches: [main,master]
branches: [cicd-docker-ec2]

jobs:
build:
runs-on: [ubuntu-latest]
steps:
- name: Checkout Source
- name: Checkout source
uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install Dependencies
run : npm install
- name: Test Project
run: npm test
- name: Login to docker hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build docker image
run: docker build -t integrationninjas/nodejs-app .
- name: Publish image to docker hub
run: docker push integrationninjas/nodejs-app:latest

deploy:
needs: build
runs-on: [runner-ec2]
steps:
- name: Pull image from docker hub
run: docker pull integrationninjas/nodejs-app:latest
- name: Delete old container
run: docker rm -f nodejs-app-container
- name: Run docker container
run: docker run -d -p 5000:5000 --name nodejs-app-container integrationninjas/nodejs-app
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:16.20.1
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 5000
CMD ["npm","run","start"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nodejs app with rest and graphql example

An example of GraphQL queries/mutations with Node and Express js.
An example of GraphQL queries/mutations with Node and Expressjs

With GraphQL, clients can specify exactly what data they need, and the server responds with only that data, reducing the amount of data transferred over the network.

Expand Down