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.
I am struggling to run the app through the Docker Container.
This is my Dockerfile
FROM node:16-alpine3.16 as development
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . ./
RUN npm run build
FROM node:16-alpine3.16 as production
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY --from=development /app/dist ./dist
CMD ["npm", "run", "start"] // electron .
I build this image this way: docker build -t oz/test-image .
I run it using the following command docker run -it -p 8080:8080 oz/test-image
And I get the following error:
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn /app/node_modules/electron/dist/electron ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /app/node_modules/electron/dist/electron',
path: '/app/node_modules/electron/dist/electron',
spawnargs: [ '.' ]
}
- I need to know how to run a GUI(Electron Application) application using docker container?
- what is wrong with what I have done above?
Thanks.