Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.

Commit 77ce59b

Browse files
committed
Include esper into build container
1 parent 6b69a65 commit 77ce59b

6 files changed

Lines changed: 67 additions & 48 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55

66
before_script:
77
- cp Configuration.mk.example Configuration.mk
8-
- docker build --tag esper-build ./contrib/build-container
8+
- docker build --tag esper-build .
99

1010
script:
1111
- docker run -it --rm --volume $(pwd):/home/builder/site --volume $(pwd):/home/builder/esper esper-build

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
## Unreleased
44
### Breaking changes
55
- `PulseFeature` has ben renamed to `Pulse`
6-
- `UPDATE_TOPIC` is now hardcoded to `${MQTT_REALM}/update`.
6+
- `UPDATE_TOPIC` is now hardcoded to `${MQTT_REALM}/update`.
7+
- Docker file moved to project root.
8+
- Build output moved from esper directory to site directory.
79

810
### Features
911
- Added `${MQTT_REALM}/${DEVICE_ID}/status` containing `ONLINE` or `OFFLINE`
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,16 @@ RUN git clone https://github.com/SmingHub/Sming.git /home/builder/Sming \
6060
ENV COM_PORT /dev/ttyESP
6161
ENV COM_SPEED 115200
6262

63-
ENV ESPER /home/builder/esper
64-
ENV SITE /home/builder/site
63+
# Copy local esper
64+
COPY . /home/builder/esper/
6565

66+
# Switch back user and set workdir for building
6667
USER root
6768
WORKDIR /home/builder/esper
6869

70+
# Set variables for build
71+
ENV ESPER /home/builder/esper
72+
ENV SITE /home/builder/site
73+
6974
CMD make
7075

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif
99

1010

1111
export BUILDDIR = $(BASEDIR)/build
12-
export DISTDIR = $(BASEDIR)/dist
12+
export DISTDIR = $(SITEDIR)/dist
1313

1414

1515
# Find devices

README.md

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ For easy management, devices publish current status information and can be updat
1010

1111
## Requirements
1212

13-
For build, ESPer requires [Sming](https://github.com/SmingHub/Sming) to be installed. We recommend using our Docker Image (`esperhub/esper`), which already contains all required dependencies.
13+
For build, ESPer requires [Sming](https://github.com/SmingHub/Sming) to be installed.
14+
We recommend using our Docker Image (`esperhub/esper`), which already contains all required dependencies.
1415

1516
During runtime, a 2.4GHz WiFi Network with WPA or WPA2 encryption is required.
1617
It is highly recommended to use a separated network for ESPer based devices to limit the broadcast and multicast traffic.
@@ -25,17 +26,11 @@ Depending on the features used, some services must be provided in the environmen
2526

2627
### Create a site directory
2728
Create a project directory and initialize it as `git` repository:
28-
~~~~
29+
```
2930
mkdir my-site
3031
cd my-site
3132
git init
32-
~~~~
33-
34-
### Add ESPer Repository
35-
Add the ESPer framework repository as submodule:
36-
~~~~
37-
git submodule add https://github.com/esper-hub/esper.git
38-
~~~~
33+
```
3934

4035
### Create environment configuration
4136
Then copy `esper/Configuration.mx.example` to `./Configuration.mk` and change it according to the target environment.
@@ -49,15 +44,58 @@ has several examples you can draw inspiration from.
4944

5045
### Build the firmware
5146
Execute the makefile in the ESPer directory while specifying esper and site directory:
52-
~~~~
53-
docker run -it --rm --volume /home/user/esper-site:/home/builder/site --volume /home/user/esper-site/esper:/home/builder/esper esperhub/esper:latest
54-
~~~~
55-
The resulting images will be in `/home/user/esper-site/esper/dist`.
47+
```shell
48+
docker run \
49+
--tty \
50+
--interactive \
51+
--device ${DEVICE}:/dev/ttyESP \
52+
--volume ${SITE}:/home/builder/site \
53+
esperhub:esper
54+
```
55+
Replace `${DEVICE}` and `${SITE}` with the correct paths.
56+
57+
The resulting images will be in `${SITE}/dist`.
5658

5759
### Flash the firmware
58-
Connect the ESP to your computer and boot it into the flash mode. Then execute the following command:
59-
~~~~
60-
docker run -it --rm --volume /home/user/esper-site:/home/builder/site --volume /home/user/esper-site/esper:/home/builder/esper esperhub/esper:latest make mydev/flash
61-
~~~~
60+
Connect the ESP to your computer and boot it into the flash mode. Then append the folllowing to the docker command above:
61+
```
62+
make mydev/flash
63+
```
64+
6265
Once flashed the container will attach to the ESPs terminal.
6366

67+
## Docker build-container
68+
The build-container allows to build ESPer in a defined environment.
69+
It is available at `esperhub/esper` with tags `latest` (master branch) and `develop`.
70+
71+
### Build the docker container (optional):
72+
```shell
73+
docker build --tag esperhub/builder:local .
74+
```
75+
This must be done only once after updating the container.
76+
77+
### Run the docker container
78+
```shell
79+
docker run \
80+
--tty \
81+
--interactive \
82+
--device ${DEVICE}:/dev/ttyESP \
83+
--volume ${SITE}:/home/builder/site \
84+
esperhub:esper
85+
```
86+
Replace `${DEVICE}` and `${SITE}` with the correct paths.
87+
88+
### Development
89+
90+
This container can also be used for development of esper itself.
91+
To do so, the local esper repository can be mounted into the container by adding another the following parameter:
92+
93+
```shell
94+
docker run \
95+
... \
96+
--volume ${ESPER}:/home/builder/esper \
97+
... \
98+
```
99+
100+
This will override the bundled esper version with the local one.
101+

contrib/build-container/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)