mirror of
https://github.com/meshtastic/python.git
synced 2026-06-16 03:19:30 -04:00
41 lines
1.1 KiB
Docker
41 lines
1.1 KiB
Docker
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
#
|
|
# Copyright (C) 2025 Olliver Schinagl <oliver@schinagl.nl>
|
|
|
|
ARG TARGET_VERSION="3.11-alpine"
|
|
ARG TARGET_ARCH="library"
|
|
|
|
FROM docker.io/${TARGET_ARCH}/python:${TARGET_VERSION} AS builder
|
|
|
|
WORKDIR /tmp/build
|
|
|
|
COPY pyproject.toml poetry.lock /tmp/build/
|
|
|
|
RUN apk add --no-cache --virtual .build-deps build-base libffi-dev && \
|
|
pip install --no-cache-dir 'poetry==2.4.1' && \
|
|
poetry config virtualenvs.create false && \
|
|
poetry install --without dev --extras cli --extras tunnel --no-interaction --no-ansi --no-root
|
|
|
|
COPY . /tmp/build/
|
|
|
|
RUN poetry build --format wheel --no-interaction
|
|
|
|
FROM docker.io/${TARGET_ARCH}/python:${TARGET_VERSION}
|
|
|
|
RUN apk add --no-cache libffi && \
|
|
addgroup -S meshtastic && \
|
|
adduser -S -G meshtastic -h /home/meshtastic meshtastic
|
|
|
|
COPY --from=builder /tmp/build/dist/*.whl /tmp/
|
|
|
|
RUN wheel=$(echo /tmp/meshtastic-*.whl) && pip install --no-cache-dir "${wheel}[cli,tunnel]" && \
|
|
rm -f /tmp/meshtastic-*.whl
|
|
|
|
COPY "./bin/container-entrypoint.sh" "/init"
|
|
RUN chmod 0755 /init
|
|
|
|
WORKDIR /home/meshtastic
|
|
USER meshtastic
|
|
|
|
ENTRYPOINT [ "/init" ]
|