Skip to content

A VueJs + NodeJs hello world app built for Jenkins CI/CD

Notifications You must be signed in to change notification settings

donghao0210/hello-jenkins-nvjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello-jenkins-nvjs (Frontend + Backend)

This is a 'hello world' app with a Node.js backend API and a Vue.js frontend, both running in Docker containers. The app is built to demonstrate API calls and the integration of both services. This repository includes instructions to run the app locally.

Prerequisites

  • Docker: You need Docker installed to build and run the app containers.
  • Node.js: Required for the backend (if you want to run it locally without Docker).
  • npm/yarn: Required for installing dependencies for both frontend and backend.

Running the App Locally (Without Docker)

1. Clone the Repository

git clone https://github.com/donghao0210/hello-jenkins-nvjs.git
cd hello-jenkins-nvjs

2. Run the Backend

Go to the backend/ folder and install dependencies:

cd backend
npm install
npm start  # Runs the backend on http://localhost:3000

3. Run the Frontend

Go to the frontend/ folder and install dependencies:

cd frontend
npm install
npm run serve  # Runs the frontend on http://localhost:8080

Now, you should be able to access the backend API on http://localhost:3000 and the frontend on http://localhost:8080.


Running the App with Docker

To run both the backend and frontend using Docker, follow these steps:

1. Build and Run Backend Docker Container

Navigate to the root of the repository and build the backend image:

# docker build -t backend-api -f backend/Dockerfile .
docker build -t registry.gnod.lol/backend-api:dev -f backend/Dockerfile .
docker run -d --name backend \
    -p 3000:3000 \
    --env ENVIRONMENT=dev \
    registry.gnod.lol/backend-api:dev

This will build the backend Docker image and start the container, exposing port 3000.

2. Build and Run Frontend Docker Container

Similarly, build and run the frontend Docker image:

docker build -t registry.gnod.lol/frontend-app:dev -f frontend/Dockerfile .
docker run -d --name frontend \
    -p 3000:3000 \
    --env ENVIRONMENT=dev \
    registry.gnod.lol/frontend-app:dev

This will build the frontend Docker image and start the container, exposing port 80.

3. Check if Containers are Running

To check if your containers are running:

docker ps

You should see the backend-api running on port 3000 and frontend-app running on port 80.

Now you can access the frontend on http://localhost and the backend API on http://localhost:3000.

Troubleshooting

  • Docker Errors: If you're having issues building or running Docker containers, check if Docker is installed correctly and if your user has the necessary permissions.
  • Frontend not loading: If the frontend doesn't load, make sure the backend container is running and accessible at http://localhost:3000.

About

A VueJs + NodeJs hello world app built for Jenkins CI/CD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published