1- # see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/
2- FROM python:3.13-slim-bookworm
1+ FROM python:3.12-alpine3.22
2+
3+ RUN apk add --no-cache grep dnsmasq curl wireless-tools
4+ # freetype-dev \
5+ # libjpeg-turbo-dev \
6+ # gcc \
7+ # musl-dev \
8+ # linux-headers
9+
10+ # use latest version. If specific version is required, it should be provided as vX.Y.Z, e.g v4.11.37
11+ ARG VERSION="latest"
12+
13+ # create /usr/src/app/ui directory where we will extract pre-built UI
14+ WORKDIR /usr/src/app/ui
315
4- # Set our working directory
516WORKDIR /usr/src/app
617
18+ RUN \
19+ export BASE_URL="https://github.com/balena-os/wifi-connect/releases" &&\
20+ DETECTED_ARCH=$(uname -m) &&\
21+ case $DETECTED_ARCH in \
22+ "aarch64") \
23+ BINARY_ARCH_NAME="aarch64-unknown-linux-gnu" ;; \
24+ "x86_64") \
25+ BINARY_ARCH_NAME="x86_64-unknown-linux-gnu" ;;\
26+ "armv7l") \
27+ BINARY_ARCH_NAME="armv7-unknown-linux-gnueabihf" ;;\
28+ *) \
29+ echo >&2 "error: unsupported architecture ($DETECTED_ARCH)"; exit 1 ;; \
30+ esac;\
31+ if [ ${VERSION} = "latest" ]; then \
32+ export URL_PARTIAL="latest/download" ; \
33+ else \
34+ export URL_PARTIAL="download/${VERSION}" ; \
35+ fi; \
36+ curl -Ls "$BASE_URL/$URL_PARTIAL/wifi-connect-$BINARY_ARCH_NAME.tar.gz" \
37+ | tar -xvz -C /usr/src/app/ && \
38+ curl -Ls "$BASE_URL/$URL_PARTIAL/wifi-connect-ui.tar.gz" \
39+ | tar -xvz -C /usr/src/app/ui
40+
741# Copy requirements.txt first for better cache on later pushes
842COPY requirements.txt requirements.txt
943
@@ -13,5 +47,7 @@ RUN pip install -r requirements.txt
1347# This will copy all files in our root to the working directory in the container
1448COPY . ./
1549
50+ COPY scripts/start.sh .
51+
1652# main.py will run when container starts up on the device
17- CMD ["python","-u","src/app.py "]
53+ CMD ["sh", "./start.sh "]
0 commit comments