Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

docker: update Dockerfile with metadata labels, environment variables, and user permissions (#8637)

Myles Scolnickf73cbbab6f7d
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 1d93de836c..a3765c9a66 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,8 +1,11 @@
# syntax=docker/dockerfile:1.12
FROM python:3.13-slim AS base
+LABEL org.opencontainers.image.source="https://github.com/marimo-team/marimo"
+LABEL org.opencontainers.image.description="marimo reactive notebook"
+
# Make `uv` and `uvx` available in the PATH for all target images
-COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
+COPY --from=ghcr.io/astral-sh/uv:0.10.9 /uv /uvx /bin/
# Create a non-root user
RUN useradd -m appuser
@@ -10,11 +13,17 @@ RUN useradd -m appuser
WORKDIR /app
ARG marimo_version=0.12.8
+LABEL org.opencontainers.image.version="${marimo_version}"
+
ENV MARIMO_SKIP_UPDATE_CHECK=1
ENV UV_SYSTEM_PYTHON=1
+ENV UV_COMPILE_BYTECODE=1
+ENV UV_LINK_MODE=copy
RUN uv pip install --no-cache-dir marimo==${marimo_version} && \
mkdir -p /app/data && \
- chown -R appuser:appuser /app
+ chown -R appuser:appuser /app && \
+ chown -R appuser:appuser /usr/local/lib/python3.13/site-packages/ && \
+ chown -R appuser:appuser /usr/local/bin/
COPY --chown=appuser:appuser marimo/_tutorials tutorials
RUN rm -rf tutorials/__init__.py
@@ -24,16 +33,24 @@ EXPOSE $PORT
ENV HOST=0.0.0.0
+STOPSIGNAL SIGTERM
+
# -slim entry point
FROM base AS slim
-CMD marimo edit --no-token -p $PORT --host $HOST
+USER appuser
+CMD ["sh", "-c", "exec marimo edit --no-token -p $PORT --host $HOST"]
# -data entry point
FROM base AS data
-RUN uv pip install --no-cache-dir marimo[recommended,lsp] altair pandas numpy
-CMD marimo edit --no-token -p $PORT --host $HOST
+USER appuser
+RUN uv pip install --no-cache-dir \
+ altair \
+ marimo[recommended,lsp] \
+ numpy \
+ pandas
+CMD ["sh", "-c", "exec marimo edit --no-token -p $PORT --host $HOST"]
# -sql entry point, extends -data
FROM data AS sql
-RUN uv pip install --no-cache-dir marimo[recommended,lsp,sql]
-CMD marimo edit --no-token -p $PORT --host $HOST
+RUN uv pip install --no-cache-dir marimo[sql]
+CMD ["sh", "-c", "exec marimo edit --no-token -p $PORT --host $HOST"]