もう少し調整している。
# Dockerfile FROM python:3.9.5-slim-buster LABEL maintainer="dogwood008" ARG WEBDAV_SERVER_ADDRESS ARG KABU_PLUS_ID ARG KABU_PLUS_PW ARG DIST ENV MOUNTPOINT /mnt/kabuplus ENV WEBDAV_SERVER_ADDRESS ${WEBDAV_SERVER_ADDRESS} ENV KABU_PLUS_ID ${KABU_PLUS_ID} ENV KABU_PLUS_PW ${KABU_PLUS_PW} ENV DIST ${DIST} RUN apt update RUN apt install -y davfs2 rsync RUN apt install -y vim curl # https://l-w-i.net/t/ubuntu/davfs2_001.txt RUN echo "${WEBDAV_SERVER_ADDRESS} ${KABU_PLUS_ID} ${KABU_PLUS_PW}" >> /etc/davfs2/secrets # https://linux.just4fun.biz/?Ubuntu/WebDAV%E3%82%92%E4%B8%80%E8%88%AC%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%81%A7%E7%89%B9%E5%AE%9A%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%E3%81%AB%E3%83%9E%E3%82%A6%E3%83%B3%E3%83%88%E3%81%99%E3%82%8B%E6%89%8B%E9%A0%86 RUN chmod 600 /etc/davfs2/secrets RUN chown root:root /etc/davfs2/secrets RUN echo "${WEBDAV_SERVER_ADDRESS} ${MOUNTPOINT} davfs user,noauto 0 0" >> /etc/fstab RUN mkdir -p ${MOUNTPOINT} COPY cmd.sh /opt/cmd.sh CMD mount ${MOUNTPOINT} && /bin/bash /opt/cmd.sh
# cmd.sh #!/bin/sh PATH_TO_PRICES_CSV=kabu.plus/json/japan-all-stock-prices/daily/ SRC=${MOUNTPOINT}/${PATH_TO_PRICES_CSV} echo src: ${SRC} echo dist: ${DIST} rsync \ --dry-run \ --archive \ --human-readable \ --verbose \ --max-size=10M \ --bwlimit=2048 \ ${SRC} \ ${DIST} rm /var/run/mount.davfs/mnt-kabuplus.pid