| ARG RELEASE |
| ARG LAUNCHPAD_BUILD_ARCH |
| LABEL org.opencontainers.image.version=24.04 |
| ADD file:d938ff3d4eee15d8600de84bf85eac6ecd0f20bc92dfe305dafbff0bdc974c0f in / |
| CMD ["/bin/bash"] |
| ENV DEBIAN_FRONTEND=noninteractive |
| RUN /bin/sh -c echo 'Acquire::http {No-Cache=True;};' > /etc/apt/apt.conf.d/no-cache && echo 'APT::Install-Recommends "0"; APT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend && echo 'Dir::Cache { srcpkgcache ""; pkgcache ""; }' > /etc/apt/apt.conf.d/02nocache && echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/02compress-indexes # buildkit |
| SHELL [/bin/bash -c] |
| RUN /bin/bash -c apt -y update && apt -y --no-install-recommends install ca-certificates curl dirmngr git gpg gpg-agent wget unzip zip software-properties-common build-essential make gcc g++ sudo cron dos2unix tini attr && curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg && echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list && apt -y update && apt -y --no-install-recommends install supervisor dumb-init iputils-ping telnet netcat-openbsd lsof net-tools openssl dnsutils rsync bind9-host stress pv fio iotop nethogs crudini xmlstarlet moreutils jq pwgen swaks vim nano cmake pkg-config openssh-client uuid less zip file apache2 libapache2-mod-perl2 apache2-dev nginx-full optipng pngquant jpegoptim sqlite3 mysql-client-8.0 redis-tools postgresql-client-16 ldap-utils gettext imagemagick graphicsmagick libcurl4 libcurl4-openssl-dev libexpat1-dev libffi-dev libgdbm-dev libicu-dev libmysqlclient-dev libncurses5-dev libpq-dev libre2-dev libreadline-dev libssl-dev libxml2-dev libxslt-dev libyaml-dev zlib1g-dev libmcrypt-dev libgmp-dev libfreetype6-dev libjpeg-dev libjpeg-turbo8-dev libpng-dev chrpath libxft-dev libfontconfig1-dev libkrb5-dev libxslt1-dev libldap2-dev libsasl2-dev libtool libvips libzmq3-dev locales-all locales libmagic1 xmlsec1 perl libimage-exiftool-perl python3-dev python3-pip python3-setuptools python3-venv ghostscript libgs-dev ffmpeg x264 x265 && rm -rf /var/cache/apt /var/lib/apt/lists # buildkit |
| ARG NODE_VERSION=24.19.0 |
| RUN |1 NODE_VERSION=24.19.0 /bin/bash -c mkdir -p /usr/local/node-$NODE_VERSION && curl -L https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz | tar zxf - --strip-components 1 -C /usr/local/node-$NODE_VERSION # buildkit |
| RUN |1 NODE_VERSION=24.19.0 /bin/bash -c curl https://downloads.mongodb.com/compass/mongodb-mongosh_2.9.2_amd64.deb -o /tmp/mongosh.deb && dpkg -i /tmp/mongosh.deb && rm /tmp/mongosh.deb && curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.11.0.deb -o /tmp/mongotools.deb && dpkg -i /tmp/mongotools.deb && rm /tmp/mongotools.deb # buildkit |
| RUN |1 NODE_VERSION=24.19.0 /bin/bash -c curl -L https://github.com/tianon/gosu/releases/download/1.19/gosu-amd64 -o /usr/local/bin/gosu && chmod +x /usr/local/bin/gosu # buildkit |
| ARG YQVERSION=4.53.3 |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c curl -sL https://github.com/mikefarah/yq/releases/download/v${YQVERSION}/yq_linux_amd64 -o /usr/bin/yq && chmod +x /usr/bin/yq # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c userdel --remove ubuntu && adduser --uid 1000 --disabled-login --gecos 'Cloudron' cloudron && passwd -d cloudron # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c addgroup --gid 500 --system media && usermod -a -G media cloudron && usermod -a -G media www-data # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c echo "set noswapfile" >> /root/.vimrc && gosu cloudron:cloudron bash -c 'echo "set noswapfile" >> /home/cloudron/.vimrc' && echo "unset historylog" >> /etc/nanorc # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8 # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c for dir in .cache .config .node-gyp .npm .mongodb .ssh .yarn .local; do rm -rf /root/${dir} && ln -sf /run/root${dir} /root/${dir} && mkdir /run/root${dir}; rm -rf /home/cloudron/${dir} && ln -sf /run/cloudron${dir} /home/cloudron/${dir} && mkdir /run/cloudron${dir} && chown --no-dereference cloudron:cloudron /home/cloudron/${dir}; chown cloudron:cloudron /run/cloudron${dir}; done # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c for file in .bash_history .dbshell .inputrc .irb_history .mongorc.js .mysql_history .psql_history .mongoshrc.js .yarnrc; do ln -sf /run/root${file} /root/${file}; ln -sf /run/cloudron${file} /home/cloudron/${file} && chown --no-dereference cloudron:cloudron /home/cloudron/${file}; done # buildkit |
| COPY cloudron_addons /usr/local/cloudron_addons # buildkit |
| RUN |2 NODE_VERSION=24.19.0 YQVERSION=4.53.3 /bin/bash -c echo -e "\nsource /usr/local/cloudron_addons\n\n[[ -f /app/data/.bashrc ]] && source /app/data/.bashrc\n" >> /root/.bashrc # buildkit |
| ENV PATH=/usr/local/node-24.19.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| RUN /bin/bash -c mkdir -p /app/code /app/data # buildkit |
| RUN /bin/bash -c apt-get update && apt-get install -y --no-install-recommends curl ca-certificates ne ffmpeg build-essential python3 pkg-config && update-ca-certificates --fresh || true && rm -rf /var/lib/apt/lists/* # buildkit |
| WORKDIR /app/code |
| RUN /bin/bash -c ln -sf /app/data/node_modules /app/code/node_modules && ln -sf /app/data/storage /app/code/storage && ln -sf /app/data/.env /app/code/.env # buildkit |
| ARG PAGELM_REF=main |
| ARG PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c set -eu; TARBALL_URL="${PAGELM_REPO}/${PAGELM_REF}.tar.gz"; echo "==> Downloading PageLM source: ${TARBALL_URL}"; curl -fsSL --retry 3 -o /tmp/pagelm.tar.gz "${TARBALL_URL}"; tar -xzf /tmp/pagelm.tar.gz -C /tmp; SRCDIR=$(find /tmp -maxdepth 1 -type d -name 'PageLM-*' | head -n 1); echo "==> Extracted source to: ${SRCDIR}"; cp -a "${SRCDIR}/backend" /app/code/backend; cp -a "${SRCDIR}/frontend" /app/code/frontend; cp "${SRCDIR}/package.json" /app/code/package.json; cp "${SRCDIR}/package-lock.json" /app/code/package-lock.json || true; cp "${SRCDIR}/.npmrc" /app/code/.npmrc || true; cp "${SRCDIR}/.env.example" /app/code/defaults.env.example; { echo "legacy-peer-deps=true"; } > /app/code/.npmrc-local && if [[ -f /app/code/.npmrc ]]; then cat /app/code/.npmrc-local >> /app/code/.npmrc; else mv /app/code/.npmrc-local /app/code/.npmrc; fi; rm -f /app/code/.npmrc-local; rm -rf "/tmp/pagelm.tar.gz" "${SRCDIR}" # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c echo "==> Patching frontend/src/lib/api.ts: same-origin WS + podcast URLs for empty env.backend" && python3 - <<'PYEOF'
import pathlib
p = pathlib.Path("/app/code/frontend/src/lib/api.ts")
t = p.read_text()
old_ws = 'function wsURL(path: string) {\n const u = new URL(env.backend);\n const proto = u.protocol === "https:" ? "wss:" : "ws:";\n return `${proto}//${u.host}${path}`;\n}'
new_ws = 'function wsURL(path: string) {\n const base = (env.backend && env.backend.length > 0)\n ? env.backend\n : (typeof window !== "undefined" ? window.location.origin : "http://localhost");\n const u = new URL(base);\n const proto = u.protocol === "https:" ? "wss:" : "ws:";\n return `${proto}//${u.host}${path}`;\n}'
assert old_ws in t, "could not locate wsURL() block to patch"
t = t.replace(old_ws, new_ws)
old_pod = 'const wsUrl = `${env.backend.replace(/^http/, "ws")}/ws/podcast?pid=${pid}`'
new_pod = 'const _podBase = (env.backend && env.backend.length > 0) ? env.backend : (typeof window !== "undefined" ? window.location.origin : "http://localhost");\n const wsUrl = `${_podBase.replace(/^http/, "ws")}/ws/podcast?pid=${pid}`'
assert old_pod in t, "could not locate podcast wsUrl line to patch"
t = t.replace(old_pod, new_pod)
p.write_text(t)
PYEOF # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c echo "==> Installing root/backend dependencies" && npm install --legacy-peer-deps --no-audit --no-fund # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c echo "==> Building backend (TypeScript)" && npm run build # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c echo "==> Installing frontend dependencies" && cd /app/code/frontend && if [[ -f .npmrc ]]; then echo "legacy-peer-deps=true" >> .npmrc; else echo "legacy-peer-deps=true" > .npmrc; fi && npm install --legacy-peer-deps --no-audit --no-fund # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c echo "==> Building frontend (Vite) with same-origin API" && cd /app/code/frontend && VITE_BACKEND_URL="" VITE_TIMEOUT=90000 npm run build && cp -a /app/code/frontend/dist /app/code/frontend-dist && rm -rf /app/code/frontend/node_modules /app/code/frontend/dist # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c mkdir -p /app/code/defaults && cp /app/code/defaults.env.example /app/code/defaults/.env.example && rm -f /app/code/defaults.env.example # buildkit |
| COPY cloudron-entry.js /app/code/cloudron-entry.js # buildkit |
| COPY start.sh /app/code/start.sh # buildkit |
| RUN |2 PAGELM_REF=main PAGELM_REPO=https://github.com/CaviraOSS/PageLM/archive /bin/bash -c chmod +x /app/code/start.sh # buildkit |
| CMD ["/app/code/start.sh"] |