Remove dependancies from package.json when building a docker image - node.js

So I have an express / nodejs web server, that I can run two ways:
run it as a desktop electron app based web server, so we can run it in offline environments
Build it into an image that runs as a node server with no electron
I am wondering, when I do build the image using a dockerfile, is there a way to remove the electron dependencies as it is not needed in the docker container
Or would i create two projects with different package.json files that use the same files?

Related

Running Vue JS project in Docker

I have already built a few VueJs applications for myself. Now I am working with a team. One backend and me frontend.
Now I'm wondering how do I include the environment in the repository. Until today I always had node on my local machine. With nvm I could also jump between versions on the local machine. But now I want future colleagues who will develop the app to have the same environment. So work with the same node and npm version. I thought this could be done with a dockerfile or docker-compose.yml. Then I can log into the container and run the npm run build for example.
Question But how does it work with npm run dev? Do I have access with the browser to the port that is assigned in the container of the Vue app?

Building and deploying production build of Node.js TypeScript server

I see many questions about how to deploy production build of Node.js app on server, but I not found any about building and deploying TypeScript server.
I am using GitHub Actions to build my TS into JS to /dist folder, but I realized that I can't just move this folder to server and start it.
I also still need to install dependencies, because it is not same as on Client-side (React for example) where all dependencies are bundled.
Are there any best practices how to automatically deploy those kinds of server apps?
Or it is simple as:
Bulding TS to JS
Moving /dist and package.json to production server
Running script on server to yarn install and launch pm2

can we deploy an react js application without source(src folder) code locally

some background:this is my first react application and my assumption is build in react is similar to binary files in c++
question : this is for a react application which sole purpose is to run locally. is there anyway we can do npm start only with build
have tried to delete the src folder after building.
expected result is the app should run as usual.
actual result : app crashes saying, index.js file is missing
npm start won`t work with build version,
you need to install serve and run build using serve locally on your machine
npm install -g serve
serve -s build
ref: https://facebook.github.io/create-react-app/docs/deployment

How to to use Docker for ElectronJS app built in Windows?

I am working on a desktop application build using ElectronJS framework on Windows.
May be I haven't understood Docker properly, but how do I use docker for this app?
My end goal is to not let people install node, npm and electron packages on their local system. They can use the docker image to develop this application.
Update
I figured out how to package my project in docker image. Now I am struggling to run the app through the Docker Container.
How to run a GUI(Electron Application) application using docker container?
Thanks.
In your case you need custom docker images that will have node, npm and ElectronJS in it.
I found one such image on dockerhub, you can use it or build your own custom image by checking its dockerfile.

Running multiple Meteor instances out of the same bundle

Say I've built a Meteor application running meteor build and instructed it to output to a folder with --directory flag.
Can I use the same directory to run multiple instances of the meteor app's server? Won't they interfere with each other?

Resources