Skip to content

Commit 0531c91

Browse files
committed
Container: Add initial container for meshtastic-cli
Just a quick set of files to enable the build of (tagged) containers. Both alpine and debian containers are available (~200MiB/~1.2GiB) allowing us to use meshtastic cli with a quick docker run, instead of having to build/install stuff locally. Signed-off-by: Olliver Schinagl <[email protected]>
1 parent dcd077d commit 0531c91

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

Containerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Containerfile.alpine

Containerfile.alpine

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ARG TARGET_VERSION="3.11-alpine"
2+
ARG TARGET_ARCH="library"
3+
4+
FROM docker.io/${TARGET_ARCH}/python:${TARGET_VERSION}
5+
6+
WORKDIR /src
7+
8+
COPY . /src/
9+
10+
RUN _poetry_venv_dir="$(mktemp -d -p "${TMPDIR:-/tmp}" 'poetry_venv.XXXXXX')" && \
11+
python -m 'venv' "${_poetry_venv_dir}" && \
12+
"${_poetry_venv_dir}/bin/pip" install 'poetry' && \
13+
"${_poetry_venv_dir}/bin/poetry" config --local virtualenvs.create false && \
14+
"${_poetry_venv_dir}/bin/poetry" install && \
15+
rm -f -r "${_poetry_venv_dir}" && \
16+
rm -f -r "/src"
17+
18+
WORKDIR /
19+
20+
COPY "./bin/container-entrypoint.sh" "/init"
21+
22+
ENTRYPOINT [ "/init" ]

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Containerfile

bin/container-entrypoint.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
#
4+
# Copyright (C) 2025 Olliver Schinagl <[email protected]>
5+
#
6+
# A beginning user should be able to docker run image bash (or sh) without
7+
# needing to learn about --entrypoint
8+
# https://github.com/docker-library/official-images#consistency
9+
10+
set -eu
11+
12+
bin='meshtastic'
13+
14+
# run command if it is not starting with a "-" and is an executable in PATH
15+
if [ "${#}" -le 0 ] || \
16+
[ "${1#-}" != "${1}" ] || \
17+
[ -d "${1}" ] || \
18+
! command -v "${1}" > '/dev/null' 2>&1; then
19+
entrypoint='true'
20+
fi
21+
22+
exec ${entrypoint:+${bin:?}} "${@}"
23+
24+
exit 0

0 commit comments

Comments
 (0)