From 8ff2ba15275ae1a4fe44d513a75fee3c3097831f Mon Sep 17 00:00:00 2001 From: George Date: Wed, 7 Sep 2022 09:09:55 -0600 Subject: [PATCH] Add Dockerfile for containerizing Update README.md to include installation, building, and execution instructions Explain briefly x11 driver requirements --- Dockerfile | 10 ++++++++++ README.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..39a6ebe5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:12.22-buster-slim as gui + +RUN apt-get update && apt-get install -y libgtk-3-0 libx11-xcb1 libxss1 libgconf-2-4 libnss3 libasound2 + +WORKDIR /app +COPY . . +RUN yarn --network-timeout 100000 + +EXPOSE 1212 +CMD ["yarn","dev"] diff --git a/README.md b/README.md index 0de0737b..f2cbe6f5 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,37 @@ $ mv evolver-electron-1.0.0.AppImage-new evolver-electron-1.0.0.AppImage $ sudo reboot now ``` +## Docker Build and Run + +Download and install Docker. + + + Linux: check your package manager / distribution instructions. + + Mac: [Instructions](https://docs.docker.com/docker-for-mac/install/) + + Windows: [Instructions](https://docs.docker.com/docker-for-windows/install/) (Windows 10) / [Instructions](https://docs.docker.com/toolbox/toolbox_install_windows/) (Windows 7/8) + +Pull, and Build the image: +```bash + docker build -t evolver-electron . + docker run -p 1212:1212 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY:0 evolver-electron +``` + +### Docker Additional Requirement + eVOLVER relies on x11 as a GUI which can be installed following the instructions below and replacing the environmental variable `DISPLAY=$DISPLAY:0` with an appropriate line from `Docker Environmental Variables` sub-section + +Macs, can install [xQuartz](https://www.xquartz.org/) with additional configuration [here](https://gist.github.com/cschiewek/246a244ba23da8b9f0e7b11a68bf3285) +Windows, can install [Cygwin](https://x.cygwin.com/) with additional configuraiton [here](https://www.kombitz.com/2020/01/31/how-to-configure-cygwin-x-for-remote-connection/) +A restart may be needed after installation, but a test container can be ran via: +```bash +docker run -p 1212:1212 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY:0 nonasoftware/evolver-electron:latest +``` + +### Docker Environmental Variables +``` +macOS: -e DISPLAY=docker.for.mac.host.internal:0 +Windows: -e DISPLAY=host.docker.internal:0 +Linux: --net=host -e DISPLAY=:0 +``` + ## Credit - [Zachary Heins](https://github.com/zheins)