49 lines
2.5 KiB
Docker
49 lines
2.5 KiB
Docker
FROM python:3.12-slim AS build
|
|
WORKDIR /app
|
|
COPY app/requirements.txt .
|
|
RUN pip install --no-cache-dir --prefix=/inst -r requirements.txt
|
|
|
|
FROM python:3.12-slim
|
|
LABEL org.opencontainers.image.title="Server Up" org.opencontainers.image.version="0.3.0"
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git openssh-client curl tar gzip ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Docker CLI + docker-compose inside container
|
|
RUN DPKG_ARCH=$(dpkg --print-architecture) \
|
|
&& case "$DPKG_ARCH" in \
|
|
amd64) DOCKER_ARCH=x86_64; COMPOSE_ARCH=x86_64 ;; \
|
|
arm64) DOCKER_ARCH=aarch64; COMPOSE_ARCH=aarch64 ;; \
|
|
armhf) DOCKER_ARCH=armhf; COMPOSE_ARCH=armv7 ;; \
|
|
*) DOCKER_ARCH=$DPKG_ARCH; COMPOSE_ARCH=$DPKG_ARCH ;; \
|
|
esac \
|
|
&& curl -fsSL "https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-27.5.1.tgz" \
|
|
| tar xz --strip-components=1 -C /usr/local/bin docker/docker \
|
|
&& chmod +x /usr/local/bin/docker \
|
|
&& curl -fsSL "https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-linux-${COMPOSE_ARCH}" \
|
|
-o /usr/local/bin/docker-compose \
|
|
&& chmod +x /usr/local/bin/docker-compose \
|
|
&& mkdir -p /usr/local/lib/docker/cli-plugins /usr/libexec/docker/cli-plugins \
|
|
&& ln -sf /usr/local/bin/docker-compose /usr/local/lib/docker/cli-plugins/docker-compose \
|
|
&& ln -sf /usr/local/bin/docker-compose /usr/libexec/docker/cli-plugins/docker-compose
|
|
|
|
COPY --from=build /inst /usr/local
|
|
WORKDIR /app
|
|
COPY app/ ./
|
|
COPY modules/ ./modules-bundled/
|
|
RUN mkdir -p static/fonts \
|
|
&& curl -fsSL "https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css" -o static/fonts/mdi.min.css \
|
|
&& curl -fsSL "https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/fonts/materialdesignicons-webfont.woff2" -o static/fonts/materialdesignicons-webfont.woff2 \
|
|
&& sed -i "s|https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/fonts/||g" static/fonts/mdi.min.css
|
|
|
|
# Directories + git safe.directory (fix dubious ownership)
|
|
RUN mkdir -p /data/stacks /data/appdata /data/backups /data/git modules /root \
|
|
&& printf '[safe]\n\tdirectory = *\n' > /root/.gitconfig
|
|
|
|
ENV PYTHONUNBUFFERED=1 PORT=5000 HOME=/root \
|
|
SU_VERSION=0.3.0 \
|
|
SU_CONFIG=/data/config.json SU_AUDIT=/data/audit.db SU_GIT_CACHE=/data/git \
|
|
GIT_SSH_COMMAND="ssh -F /dev/null -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
EXPOSE 5000
|
|
HEALTHCHECK --interval=30s --timeout=8s --start-period=15s CMD curl -fs http://localhost:5000/api/docker/info || exit 1
|
|
CMD ["python","app.py"]
|