https://github.com/balena-io-examples/balena-electron
A simple example of how to get an Electron application running on Balena
https://github.com/balena-io-examples/balena-electron
Last synced: 15 days ago
JSON representation
A simple example of how to get an Electron application running on Balena
- Host: GitHub
- URL: https://github.com/balena-io-examples/balena-electron
- Owner: balena-io-examples
- Created: 2021-12-01T22:17:57.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-10T22:28:29.000Z (over 3 years ago)
- Last Synced: 2025-05-12T03:33:04.898Z (about 2 months ago)
- Language: Shell
- Size: 30.3 KB
- Stars: 9
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Balena Electron Example
This is a very simple, barebones example of how to get an electron app running on balena. It is split out into two parts.
- One piece is your application (this repo) that installs all dependencies for Electron to be able to run.
- This example app has an `express` server, and starts a window in kiosk mode.
- The second piece is the [xserver](https://github.com/balenablocks/xserver) block, which starts up an X11 server that your application will use to display on.
- You can see all the environment variables to configure xserver [here](https://github.com/balenablocks/xserver#environment-variables)[](https://dashboard.balena-cloud.com/deploy?repoUrl=https://github.com/balena-io-examples/balena-electron)
## Example `docker-compose.yml`
```
version: '2.1'
volumes:
# we create a shared volume so that the xserver can mount its socket file, and our application container will be able to use it to display
xserver-volume:
services:
xserver:
image: balenablocks/xserver
restart: always
privileged: true
volumes:
# when we start, a UNIX socket is mounted in this directory, for communication to the X server
- 'xserver-volume:/tmp/.X11-unix'
balena-electron:
build: .
restart: always
network_mode: host
ports:
- 8080:8080
volumes:
# We will have access to the UNIX socket shared by xserver after it has started up.
- 'xserver-volume:/tmp/.X11-unix'
environment:
# We need to specify which display we want to use for the X server. :0 is the first display that we have plugged in. This because there is no default display specified.
- DISPLAY=:0
```## Build for multiple architectures
There is an example script in this repo which uses `docker buildx` to build and push mutliple architecture images, along with the manifest to a docker repo. See `build-images.sh` for the details.