mirror of
https://github.com/curly60e/pyblock.git
synced 2026-08-13 12:33:15 +02:00
Umbrel forces `user: "1000:1000"` in docker-compose, but the previous Dockerfile let useradd assign the next-free UID. Since ubuntu:24.04 ships a pre-existing `ubuntu` user at 1000, `pyblock` ended up as 1001, causing permission errors on the bind-mounted config dir reported in getumbrel/umbrel-apps#5258. - dockerfile: remove the default `ubuntu` user and pin pyblock to UID/GID 1000 so file ownership matches the user Umbrel runs as. - entrypoint.sh: fail fast with a clear, actionable message when the config dir is not writable (covers future UID-mismatch regressions). - umbrel/: bump image tag and app version to v4.0.1 with release notes. Verified with `docker run --user 1000:1000` and an empty bind-mount: all 5 config files generated successfully, ttyd serves on :6969. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
64 lines
1.8 KiB
Text
64 lines
1.8 KiB
Text
FROM ubuntu:24.04
|
|
|
|
WORKDIR /app
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYBLOCK_PORT=6969
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
build-essential cmake git libjson-c-dev libwebsockets-dev \
|
|
python3 python3-pip python3-venv \
|
|
curl jq wget \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Pin ttyd to a specific release tag for reproducibility
|
|
RUN git clone --branch 1.7.7 --depth 1 https://github.com/tsl0922/ttyd.git \
|
|
&& cd ttyd \
|
|
&& mkdir build \
|
|
&& cd build \
|
|
&& cmake .. \
|
|
&& make \
|
|
&& make install \
|
|
&& cd /app && rm -rf ttyd
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
python3-dev libgmp-dev libffi-dev \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN python3 -m venv /app/venv
|
|
ENV PATH="/app/venv/bin:$PATH"
|
|
|
|
# Copy project files
|
|
COPY requirements.txt /app/pyblock/requirements.txt
|
|
RUN pip install --no-cache-dir --upgrade pip \
|
|
&& pip install --no-cache-dir -r /app/pyblock/requirements.txt
|
|
|
|
COPY . /app/pyblock/
|
|
|
|
# Entrypoint for auto-configuration
|
|
COPY entrypoint.sh /app/entrypoint.sh
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
# Create config volume mount point
|
|
RUN mkdir -p /app/pyblock/pybitblock/config
|
|
|
|
# Pin pyblock to UID/GID 1000 so it matches the user Umbrel forces via
|
|
# `user: "1000:1000"` in docker-compose. The base ubuntu:24.04 image ships an
|
|
# `ubuntu` user already at 1000, so remove it first to free the UID.
|
|
RUN userdel -r ubuntu 2>/dev/null || true \
|
|
&& groupadd -g 1000 pyblock \
|
|
&& useradd -m -s /bin/bash -u 1000 -g 1000 pyblock \
|
|
&& chown -R pyblock:pyblock /app
|
|
|
|
USER pyblock
|
|
|
|
EXPOSE 6969
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:${PYBLOCK_PORT:-6969}/ || exit 1
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|