File size: 1,409 Bytes
966a439
 
a1166f2
 
 
 
966a439
a1166f2
 
 
 
966a439
a1166f2
 
 
 
 
966a439
a1166f2
 
 
 
 
 
 
 
 
 
 
 
 
 
10db5b3
 
 
a1166f2
966a439
 
a1166f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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

# Set environment variables
ENV VIRTUAL_ENV=/opt/venv \
  PATH="/opt/venv/bin:/home/user/.local/bin:$PATH" \
  HOME=/home/user

# Install dependencies
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

# Create directories and set permissions
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

# Set working directory
WORKDIR /data

# Copy examples
COPY --chown=user:user ./examples ./examples

# Set user
USER user

# Use heredoc with explicit delimiter
RUN <<'ENDCONFIG' cat > $HOME/.marimo.toml
[package_management]
manager = "uv"

[display]
cell_output = "below"
dataframes = "rich"
theme = "light"
ENDCONFIG


# Uncomment to enable password protection
# CMD marimo edit /data --host=0.0.0.0 --port=7860 --token-password=$(cat $HOME/.marimo_password)
CMD marimo edit /data --host=0.0.0.0 --port=7860 --no-token