How to run an electron app on docker

后端 未结 2 1426
再見小時候
再見小時候 2021-02-07 12:00

I\'ve created a fork of a repository hosting an electron app which is a chat client: https://github.com/Serkan-devel/BetterDiscordApp-docker.

What I\'m trying to do is t

2条回答
  •  不知归路
    2021-02-07 12:46

    I will try to help you here in this answer - too long for comment.

    I tried your Docker file on my Win10 and with the same problems. But I figured it out by adding required packages and successfully created docker image. Here is Dockerfile

       FROM node:slim
    
       COPY . /usr/scr/app
    
       #RUN rm bdstart.sh
       RUN apt-get update
    
       # I think you need to install following 
       RUN apt-get -y install libgtkextra-dev libgconf2-dev libnss3 libasound2 libxtst-dev libxss1
       RUN npm install --save-dev electron
    
       RUN npm install
    
       CMD ["/usr/scr/app/start.sh"]
    

    and here is your start.sh

       #!/bin/sh
       ./node_modules/.bin/electron ./src
    

    Actually I don't have access to your files and so on, but with this DockerFile was able to create docker image without problems. I also went inside docker container and check whether is possible to run electron - worked.

    If you want to go into container, you just need to build docker image. I have done it by (simplest way) following command (open console where Dockerfile is located and run):

       docker build -t test-image .
    

    After Successfully build of image you can run container. If any problems I recommend you to run container with bash entrypoint and debug what fails - bash will open in the same console where you type following script)

       docker run -it test-image bash
    

提交回复
热议问题