Skip to content

Commit badbe6b

Browse files
committed
changed docker-image to alpine
1 parent 0bb2369 commit badbe6b

File tree

10 files changed

+43
-40
lines changed

10 files changed

+43
-40
lines changed

.env-template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Attention: "host" means your computer where you are running docker on
2+
3+
WLAN=wlan0 #must match the name of your wlan-interface on your host, you may find it with ifconfig
4+
AP=vtrust-flash #the name of the created AP, can be anything you want
5+
GATEWAY=10.42.42.1 #gateway address, leave it here
6+
LOCALBACKUPDIR=./data/backups #location on your host where you want to store backuos of the old firmware & logs

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ node_modules/
109109
device-info.txt
110110
scripts/smartconfig/package-lock.json
111111

112-
# firmware backups directory
112+
# firmware backups directory and data-file
113113
backups/
114+
data
114115

115116
# flag files
116117
eula_accepted

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
FROM phusion/baseimage:master
1+
FROM alpine:3.13
22

3-
RUN apt-get update && apt-get install -y sudo iproute2 iputils-ping
3+
RUN apk add --update bash git iw dnsmasq hostapd screen curl py3-pip py3-wheel python3-dev mosquitto haveged net-tools openssl openssl-dev gcc musl-dev linux-headers sudo coreutils grep iproute2
44

5-
RUN echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
5+
RUN python3 -m pip install --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex
66

77
COPY docker/bin /usr/bin/
88

99
COPY . /usr/bin/tuya-convert
1010

11-
RUN cd /usr/bin/tuya-convert && ./install_prereq.sh
11+
WORKDIR "/usr/bin/tuya-convert"
1212

13-
RUN mkdir -p /etc/service/tuya && cd /etc/service/tuya && ln -s /usr/bin/config.sh run
13+
ENTRYPOINT ["tuya-start"]

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,24 @@ Requirements:
8383
* docker is installed
8484
* docker-compose is installed
8585

86-
Create docker image:
86+
Preparations:
8787
* git clone https://github.com/ct-Open-Source/tuya-convert
8888
* cd tuya-convert
89-
* docker build -t tuya:latest .
90-
91-
Setup docker-compose:
92-
* copy docker/docker-compose.sample.yml to a new folder you created, the file should be named docker-compose.yml
93-
* you may adjust this docker-compose.yml, if necessary:
94-
* environment-variables may be different, for example network-adapter may be different from wlan0
95-
* adjust the volume folder, where you want your backups stored
96-
97-
Run the image:
98-
* go into the folder you copied docker-compose.yml
99-
* docker-compose up -d
100-
* docker-compose exec tuya start
101-
* tuya-convert now starts within docker
102-
103-
Stop the image:
104-
* docker-compose exec tuya stop
105-
* docker-compose down
89+
* if you have already cloned this repo just cd into the directory and execute `git pull`
90+
* cp .env-template .env
91+
* adjust the created .env-file, it contains usage information as comments
92+
93+
Building and running your container:
94+
* `docker-compose build && docker-compose run --rm tuya`
95+
* This directly starts into tuya. If you press ctrl+break or exit tuya after flashing, your container is closed and deleted
96+
97+
Troubleshooting:
98+
* Q: Where are my logs after flashing? A: The folder can be adjusted in .env with LOCALBACKUPDIR, the path here may be relative or absolute
99+
* Q: I don't want that my container is deleted after running tuya, I need this for troubleshooting! How do I accomplish this? A: Just remove --rm from `docker-compose run --rm tuya`
100+
* Q: I want to start the container, but instead of starting tuya immediately I want to get into bash. Is this possible? A: Yes just start the container with `docker-compose run --entrypoint bash tuya`.
101+
* Q: I want to rebuild my docker-image, even if there are no changes. Is this possible? A: Just start `docker-compose build --no-cache` instead of `docker-compose build`! Don't do this all the time, this is a time consuming process ...
102+
* Q: I can't connect to my USB, PCI, ... network card. How do I get this working? A: You may have an error in your .env-File. The WLAN-variable should reflect the name of your network interface on your host. Execute ifconfig and look through your interfaces.
103+
* Q: I can't get an IP-address and or connection on my phone, what's the problem? A: You may look into smarthack-wifi.log (location is set in .env with LOCALBACKUPDIR) or possible stop your firewall (e.g. NixOS seems to have a problem here). It may be a problem with a wrongly set network interface (see previous question)
106104

107105
## CONTRIBUTING
108106

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
services:
3+
tuya:
4+
build: .
5+
privileged: true
6+
network_mode: "host"
7+
environment:
8+
WLAN: ${WLAN}
9+
AP: ${AP}
10+
GATEWAY: ${GATEWAY}
11+
volumes:
12+
- $LOCALBACKUPDIR:/usr/bin/tuya-convert/backups
File renamed without changes.

docker/bin/stop

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
2-
cd /usr/bin/tuya-convert
2+
config-tuya.sh
33
./start_flash.sh

docker/docker-compose.sample.yml

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

install_prereq.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
sudo apt-get update
6-
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev
6+
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev iproute2 iputils-ping
77

88
sudo -H python3 -m pip install --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex
99

0 commit comments

Comments
 (0)