seafile/Dockerfile

89 lines
2.9 KiB
Docker

# Seafile single-container image for TrueNAS SCALE Dragonfish
# Base: Debian Bookworm Slim for stable apt packages (nginx, mariadb, redis)
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TZ=UTC \
SEAFILE_HOME=/opt/seafile \
SEAFILE_DATA_DIR=/data/seafile-data \
SEAFILE_CONF_DIR=/data/conf \
SEAHUB_MEDIA_DIR=/data/seahub-media \
LOG_DIR=/data/logs
# Optional build-time args (not used to download by default; runtime entrypoint handles artifacts)
ARG SEAFILE_VERSION=""
ARG SEAFILE_TGZ_URL=""
# OS packages
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
nginx \
supervisor \
mariadb-server \
redis-server \
python3 \
python3-venv \
python3-pip \
curl \
ca-certificates \
tzdata \
procps \
gosu; \
rm -rf /var/lib/apt/lists/*
# System users/groups (many packages create their own, we ensure 'seafile' app user)
RUN set -eux; \
groupadd -r seafile; \
useradd -r -g seafile -d ${SEAFILE_HOME} -s /usr/sbin/nologin seafile || true; \
mkdir -p ${SEAFILE_HOME} ${SEAFILE_HOME}/docker \
/data/conf /data/seafile-data /data/db /data/redis /data/seahub-media /data/logs /data/ssl \
/var/log/nginx /var/run/nginx; \
chown -R seafile:seafile ${SEAFILE_HOME}; \
chown -R www-data:www-data /var/log/nginx /var/run/nginx; \
# MariaDB and Redis dirs will be owned by respective users at runtime init
true
# Copy runtime scripts and templates (will be rendered at container start)
# Expect these files to be created in repo under docker/
COPY docker/ ${SEAFILE_HOME}/docker/
# Make scripts executable
RUN set -eux; \
find ${SEAFILE_HOME}/docker -type f -name "*.sh" -exec chmod +x {} \;; \
chmod 0644 ${SEAFILE_HOME}/docker/supervisord.conf.template || true; \
chmod 0644 ${SEAFILE_HOME}/docker/nginx.conf.template || true; \
chmod 0644 ${SEAFILE_HOME}/docker/gunicorn.conf.py || true; \
chmod 0644 ${SEAFILE_HOME}/docker/seahub_settings.py.template || true
# Environment defaults (can be overridden by TrueNAS app env)
ENV SEAFILE_SERVER_HOSTNAME=localhost \
SEAFILE_SERVER_URL=http://localhost \
ADMIN_EMAIL= \
ADMIN_PASSWORD= \
DB_ROOT_PASSWORD= \
DB_NAME=seafile \
DB_USER=seafile \
DB_PASSWORD= \
DB_NAME_SEAHUB=seahub_db \
DB_NAME_SEAFILE=seafile_db \
DB_NAME_CCNET=ccnet_db \
REDIS_URL=redis://127.0.0.1:6379/0 \
TIMEZONE=UTC \
NGINX_MAX_BODY=200m \
SSL_ENABLE=false
# Ports
EXPOSE 80 443
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=10 CMD [ -x "${SEAFILE_HOME}/docker/healthcheck.sh" ] && ${SEAFILE_HOME}/docker/healthcheck.sh || exit 1
VOLUME ["/data"]
# Entrypoint manages idempotent bootstrap then hands off to supervisord
ENTRYPOINT ["/opt/seafile/docker/entrypoint.sh"]
CMD ["start"]