|
FROM python:3.12 |
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.5.1 /uv /bin/uv |
|
RUN set -ex \ |
|
&& chmod 755 /bin/uv \ |
|
&& useradd --create-home --shell /bin/bash --uid 1000 user |
|
|
|
|
|
ENV VIRTUAL_ENV=/opt/venv \ |
|
PATH="/opt/venv/bin:/home/user/.local/bin:$PATH" \ |
|
HOME=/home/user |
|
|
|
|
|
COPY --chown=user:user ./requirements.txt requirements.txt |
|
RUN uv venv $VIRTUAL_ENV \ |
|
&& uv pip install --no-cache-dir -r requirements.txt \ |
|
&& chown -R user:user $VIRTUAL_ENV |
|
|
|
|
|
RUN mkdir -p $HOME/.cache $HOME/.config /data \ |
|
&& chown -R user:user $HOME /data \ |
|
&& chmod -R 755 $HOME /data \ |
|
&& chown -R user:user /opt/venv |
|
|
|
RUN --mount=type=secret,id=MARIMO_PASSWORD \ |
|
cat /run/secrets/MARIMO_PASSWORD > $HOME/.marimo_password \ |
|
&& chmod 600 $HOME/.marimo_password \ |
|
&& chown user:user $HOME/.marimo_password |
|
|
|
|
|
WORKDIR /data |
|
|
|
|
|
COPY --chown=user:user ./examples ./examples |
|
|
|
|
|
USER user |
|
|
|
|
|
RUN <<'ENDCONFIG' cat > $HOME/.marimo.toml |
|
[package_management] |
|
manager = "uv" |
|
|
|
[display] |
|
cell_output = "below" |
|
dataframes = "rich" |
|
theme = "light" |
|
ENDCONFIG |
|
|
|
|
|
|
|
|
|
CMD marimo edit /data --host=0.0.0.0 --port=7860 --no-token |
|
|