Aaron
Aaron

Reputation: 2772

Handle build with Node.js/React App - best practice with Jenkins and Docker

Today we've created a Node.js/ReactJS app. We are using Bitbucket (git repo), Docker container along with Jenkins + AWS ECS (Elastic Container Service).

The process we use today is when we are ready to deploy and have a new version ready, we go into the /assets directory and run command gulp build. This handles the whole build/minification process and in the end gives us the version number. From here we check this into the git repo and since it has the version this becomes the tag in the repo. All good, right? :)

From here, in Jenkins we can simply run the build choosing Prod/Master for example and it takes care of grabbing all the npm packages, push docker image to ECR, updating revision within ECS. And the the service is up and running.

It seems to me that we should not be running this gulp build command locally and have to check into git repo. Not to mention this leaves the git repo a bit messy and with other developers it's not a great solution to have the 'compiled' minified files there.

Wouldn't the better practice be to have this gulp build run over on Jenkins?

However, I believe we would still like to retain the tagging within the git repo? Is there another way to achieve this?

Has anyone dealt with a similar issue or has a best practice for something like this?

Really curious to hear what you think.

Thanks in advance.

Upvotes: 0

Views: 1254

Answers (1)

Marc Young
Marc Young

Reputation: 4012

There's no "best practice" but if you want it to be less messy you can look at using a Jenkinsfile: https://jenkins.io/doc/book/pipeline/jenkinsfile/

It doesnt matter what commands you have or anything, it's just best practice for Jenkins to do it. so gulp build should run on Jenkins. The only process should be commit and push. Jenkins should handle the rest.

Upvotes: 1

Related Questions