-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
159 lines (131 loc) · 8.67 KB
/
Dockerfile
File metadata and controls
159 lines (131 loc) · 8.67 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
FROM ubuntu:24.04
# ─── Build-time arguments ──────────────────────────────────────────────────────
ARG ENGINEERING_UID=1001
ARG PYTHON_PACKAGES="structural_starterkit"
# ─── Environment ──────────────────────────────────────────────────────────────
ENV DEBIAN_FRONTEND=noninteractive \
TZ=UTC \
HOME=/home/engineering \
USER=engineering \
PYTHON_PACKAGES="${PYTHON_PACKAGES}" \
UV_PROJECT_ENVIRONMENT=/home/engineering/.venv \
PATH="/home/engineering/.venv/bin:/home/engineering/.local/bin:/usr/local/bin:${PATH}"
ENV AUTH_USERNAME="" \
AUTH_PASSWORD="" \
PYTHON_PACKAGES="structural_starterkit"
# ─── System packages ──────────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-rdepends \
curl \
cron \
dpkg \
wget \
git \
nano \
graphviz \
unzip \
sudo \
ca-certificates \
build-essential \
xz-utils \
zstd \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# ─── Caddy ────────────────────────────────────────────────────────────────────
RUN curl -fsSL "https://dl.cloudsmith.io/public/caddy/stable/gpg.key" \
| gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
&& curl -fsSL "https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt" \
| tee /etc/apt/sources.list.d/caddy-stable.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends caddy \
&& rm -rf /var/lib/apt/lists/*
# ─── GitHub CLI ───────────────────────────────────────────────────────────────
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] \
https://cli.github.com/packages stable main" \
| tee /etc/apt/sources.list.d/github-cli.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends gh \
&& rm -rf /var/lib/apt/lists/*
# ─── TinyAuth ─────────────────────────────────────────────────────────────────
RUN TINYAUTH_VERSION=$(curl -fsSL https://api.github.com/repos/steveiliop56/tinyauth/releases/latest \
| grep '"tag_name"' | sed 's/.*"\(v[^"]*\)".*/\1/') \
&& curl -fsSLo /usr/local/bin/tinyauth \
"https://github.com/steveiliop56/tinyauth/releases/download/${TINYAUTH_VERSION}/tinyauth-amd64" \
&& chmod +x /usr/local/bin/tinyauth
# ─── Quarto ───────────────────────────────────────────────────────────────────
RUN QUARTO_VERSION=$(curl -fsSL https://api.github.com/repos/quarto-dev/quarto-cli/releases/latest \
| grep '"tag_name"' | sed 's/.*"v\([^"]*\)".*/\1/') \
&& curl -fsSLo /tmp/quarto.deb \
"https://github.com/quarto-dev/quarto-cli/releases/latest/download/quarto-${QUARTO_VERSION}-linux-amd64.deb" \
&& dpkg -i /tmp/quarto.deb \
&& rm /tmp/quarto.deb
# ─── Java 11 (required for Tabula web app compatibility) ─────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-11-jre \
&& rm -rf /var/lib/apt/lists/*
# Also install tabula-java CLI for command-line use
RUN TABULA_VERSION=$(curl -fsSL https://api.github.com/repos/tabulapdf/tabula-java/releases/latest \
| grep '"tag_name"' | sed 's/.*"v\([^"]*\)".*/\1/') \
&& curl -fsSLo /usr/local/bin/tabula.jar \
"https://github.com/tabulapdf/tabula-java/releases/latest/download/tabula-${TABULA_VERSION}-jar-with-dependencies.jar" \
&& printf '#!/bin/sh\nexec java -jar /usr/local/bin/tabula.jar "$@"\n' \
> /usr/local/bin/tabula \
&& chmod +x /usr/local/bin/tabula
# ─── uv ───────────────────────────────────────────────────────────────────────
RUN curl -LsSf https://astral.sh/uv/install.sh \
| env UV_INSTALL_DIR=/usr/local/bin sh
# ─── code-server (VS Code) ────────────────────────────────────────────────────
RUN curl -fsSL https://code-server.dev/install.sh | sh
# ─── ttyd (web terminal) ──────────────────────────────────────────────────────
RUN curl -fsSLo /usr/local/bin/ttyd \
"https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64" \
&& chmod +x /usr/local/bin/ttyd
# ─── rclone - to sync with bunny.net storage ────
RUN curl -fsSL https://rclone.org/install.sh | bash
# ─── engineering user ─────────────────────────────────────────────────────────
RUN groupadd -g ${ENGINEERING_UID} engineering \
&& useradd -u ${ENGINEERING_UID} -g engineering -m -d /home/engineering \
-s /bin/bash engineering \
&& echo "engineering ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/engineering \
&& chmod 0440 /etc/sudoers.d/engineering
# ─── Oh My Bash ───────────────────────────────────────────────────────────────
RUN export HOME=/etc/skel-engineering \
&& mkdir -p /etc/skel-engineering \
&& bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" \
--unattended \
&& sed -i 's/OSH_THEME="font"/OSH_THEME="bobby-python"/' /etc/skel-engineering/.bashrc \
&& echo 'export VIRTUAL_ENV_DISABLE_PROMPT=1' >> /etc/skel-engineering/.bashrc \
&& sed -i 's|/etc/skel-engineering/.oh-my-bash|/home/engineering/.oh-my-bash|g' \
/etc/skel-engineering/.bashrc
# - Setup notroot
COPY scripts/notroot_source.sh /notroot_source.sh
COPY scripts/notroot /usr/local/bin
RUN cat /notroot_source.sh >> /etc/skel-engineering/.bashrc
# # ─── Bash venv prompt enhancement ────────────────────────────────────────────
# RUN echo '\n# Show active venv name in prompt\nexport VIRTUAL_ENV_DISABLE_PROMPT=1' \
# >> /home/engineering/.bashrc
# # Configure Oh My Bash for the engineering user
# RUN cp /root/.bashrc /home/engineering/.bashrc \
# && cp -r /root/.oh-my-bash /home/engineering/.oh-my-bash \
# && sed -i 's|/root/.oh-my-bash|/home/engineering/.oh-my-bash|g' \
# /home/engineering/.bashrc \
# && chown -R engineering:engineering \
# /home/engineering/.bashrc \
# /home/engineering/.oh-my-bash
# ─── supervisord ──────────────────────────────────────────────────────────────
RUN apt-get update \
&& apt-get install -y --no-install-recommends supervisor \
&& rm -rf /var/lib/apt/lists/*
# ─── Copy entrypoint & config ─────────────────────────────────────────────────
COPY scripts/entrypoint.sh /entrypoint.sh
COPY scripts/setup-python.sh /setup-python.sh
COPY config/Caddyfile.template /etc/caddy/Caddyfile.template
COPY config/index.html /etc/caddy/index.html
COPY config/supervisord.conf /etc/supervisord.conf
COPY content/ /etc/skel-engineering/
RUN chmod +x /entrypoint.sh /setup-python.sh /usr/local/bin/notroot
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]