-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerfile written for building docker image #395
Conversation
@jvJUCA , i have written and tested the docker file . But , haven't update the readme with docker setup steps. And coming to env handling in the project , i have used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest having two docker files for prod and dev environments are helpful rather than a single Dockerfile.
@KarinePistili @jvJUCA Your suggestions also valuable here to enhance our project Deployment options
dockerfile
Outdated
@@ -0,0 +1,28 @@ | |||
|
|||
FROM node:16 AS build-stage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use node:lts
instead node:16 to mitigate risks of compatibility in future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion!
dockerfile
Outdated
RUN npm run build | ||
|
||
# Serve the app using Node.js | ||
FROM node:16 AS production-stage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use node:alpine
to reduce the size of image in final stage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @asr2003 I think this are good suggestions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would good to use node latest here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can use node lts for build stage. node-alpine is the lighter image which we can use safely to run the already built files in Stage-1. It's the mantra we follow to reduce docker image in setup :)
We can also use bookworm-slim image too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
@xemyst were you able to test it on your environment as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @TheMohit2003, I just finished testing your commit, and for me, the code isn't working (tested after merging with the develop so this could be why), so I just changed the code and got it working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review the changes provided by the reviewers and change accordingly
@MurilonND , can you discuss the changes ? |
Sure, what you want to know? |
What error did you get, and what file changes did you make ? |
Very simple, just changed the node version to alpine (optimization), and the ERROR that I got was: [build-stage 6/6] RUN npm run build:
|
@TheMohit2003 will you be able to do the changes? |
@KarinePistili , My apologies for being late. I will send the commits by tomorrow. Just went through distro hopping ( linux )and need to setup stuff again. |
Okay, thanks! @TheMohit2003 |
Updated Dockerfile:
|
@KarinePistili , should I add docker image setup docs in readme ? |
it would be nice @TheMohit2003 , thanks |
Quality Gate passedIssues Measures |
@KarinePistili, all tasks on my end are completed. If there are any further changes you need, please let me know. Otherwise, you are free to merge the PR when you are ready. |
I will test your changes and provide any changes needed |
@asr2003 , did you review the changes ? |
Hey, how are you? @TheMohit2003, I just tested your pull request and for me, the code is not working |
I think it's interesting to put a dockerignore for node_modules |
@JulioManoel worked for me . Let me check again. Did you create a .env file with all the secrets before running the container? |
Wouldn't it be better to separate two dockerfiles, 1 for develop and another for production? |
@TheMohit2003 there was an error when building the container |
I have the .env, I gave npm i to the project and after that I tried to build docker using the README command: docker build -t uxremotelab . |
@JulioManoel , This error indicates an issue with your internet connectivity. Please verify your internet connection and try building the Docker image again. |
Sorry it was an internet problem ksks 😅 |
Thanks @TheMohit2003 ! |
Thank you for revision @JulioManoel @MurilonND @asr2003 and @xemyst |
PR description
How to test
docker build -t ruxalab .
http://localhost:5000
in your browser to view the application.