Skip to content

Packing this beautiful library to Docker #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
FROM alpine:latest

RUN apk --no-cache add \
make \
g++ \
gcc \
git \
bash \
sudo \
pkgconf \
openssl-dev \
python3 \
python3-dev \
py3-pip \
build-base \
autoconf \
automake

RUN apk --no-cache add \
npm \
nodejs

RUN apk --no-cache add \
libtool \
libusb \
libusb-dev \
libudev-zero \
libffi-dev \
libjpeg-turbo-dev \
zlib-dev \
cairo-dev \
pango-dev \
pangomm-dev \
libpng \
libpng-dev \
giflib-dev \
jpeg-dev \
librsvg-dev \
giflib \
freetype-dev

RUN apk add --no-cache pixman pixman-dev cairo pango

# Fonts (not all yet installed)
RUN apk add --no-cache font-liberation
RUN fc-cache -f
RUN mkdir /usr/share/fonts/truetype && cp -r /usr/share/fonts/liberation /usr/share/fonts/truetype

# main repo
RUN git clone https://github.com/tjaworski/AceMagic-S1-LED-TFT-Linux.git /acemagic
# additional theme
RUN git clone https://github.com/Piero24/acemagic-S1-panel-conf.git /acemagic_theme_main
RUN cp -r /acemagic_theme_main/main /acemagic/s1panel/themes/

# Just check versions
RUN node -v && npm -v && python3 --version && pip --version && gcc --version && make --version

# collect packages and build what is needed
WORKDIR /acemagic/s1panel
RUN npm update
WORKDIR /acemagic/s1panel/gui
RUN npm install
RUN npm run build


# copy one more theme to container and local config
COPY ./config.json /acemagic/s1panel
ADD ./themes/theme1 /acemagic/s1panel/themes/theme1

expose 8686
WORKDIR /acemagic/s1panel
ENTRYPOINT node main.js
28 changes: 28 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Run AceMagic-S1-LED-TFT-Linux in Docker

Just quick and dirty docker container for running panel control in a Docker.

This is first step to wrap it in Home assistant addon

My theme is heavily based on https://github.com/Piero24/acemagic-S1-panel-conf
which is also added to container if you want to use it.

## How to build locally
```bash
docker build -t acemagic-s1panel .
```

## How to run

```bash
docker run --rm --detach --privileged --name acemagic --device=/dev/ttyUSB0 -v /dev/bus/usb -v /sys/class/net/ -p 8686:8686 acemagic-s1panel:latest
```


## How You can help making it better

- Clean up packages added to container. I'm not sure that they all are needed.
- Add all font packages needed by main code
- Figure out the correct way of passing network interfaces information. I don't like the idea of using host network for such a container.
- Make better screens
- Make Portrait layout
116 changes: 116 additions & 0 deletions Docker/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"listen": "0.0.0.0:8686",
"theme": "themes/theme1/landscape.json",
"poll": 500,
"refresh": 1600,
"heartbeat": 60000,
"debug_update": false,
"theme_list": [
{
"name": "a simple demo portrait orientation",
"config": "themes/simple_demo/portrait_simple.json"
},
{
"name": "Theme1",
"config": "themes/theme1/landscape.json"
},
{
"name": "main",
"config": "themes/main/landscape_main.json"
}
],
"sensors": [
{
"module": "sensors/clock.js"
},
{
"module": "sensors/calendar.js"
},
{
"module": "sensors/cpu_usage.js",
"config": {
"max_points": 300
}
},
{
"module": "sensors/cpu_temp.js",
"config": {
"max_points": 300,
"fahrenheit": false
}
},
{
"module": "sensors/cpu_power.js",
"config": {
"max_points": 300
}
},
{
"module": "sensors/network.js",
"config": {
"interface": "wlp3s0",
"max_points": 300
}
},
{
"module": "sensors/network.js",
"config": {
"interface": "enp2s0",
"max_points": 300
}
},
{
"module": "sensors/network.js",
"config": {
"interface": "enp4s0",
"max_points": 300
}
},
{
"module": "sensors/memory.js",
"config": {
"max_points": 300
}
},
{
"module": "sensors/space.js",
"config": {
"name": "root",
"mount_point": "/",
"max_points": 300
}
},
{
"module": "sensors/weather.js",
"config": {
"name": "Moscow",
"country": "RU",
"imperial": false,
"forecast": 1
}
}
],
"widgets": [
"widgets/text.js",
"widgets/custom_bar.js",
"widgets/line_chart.js",
"widgets/doughnut_chart.js",
"widgets/bar_chart.js",
"widgets/image.js",
"widgets/iconify.js",
"widgets/weather_icon.js"
],
"canvas": {
"width": 320,
"height": 170,
"pixel": "RGB16_565"
},
"device": "1-8:1.1",
"led_config": {
"device": "/dev/ttyUSB0",
"theme": 2,
"speed": 3,
"intensity": 3
},
"portrait": true
}
1 change: 1 addition & 0 deletions Docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run --rm --detach --privileged --name acemagic --device=/dev/ttyUSB0 -v /dev/bus/usb -v /sys/class/net/ -p 8686:8686 acemagic-s1panel:latest
Binary file added Docker/themes/theme1/imgs/80s_city.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docker/themes/theme1/imgs/city.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docker/themes/theme1/imgs/neon_street.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading