FROM oven/bun:1.4.2-alpine AS builder # radicale 任务依赖 git 读取 yaml/png 的提交时间作为 REV RUN apk add --no-cache git WORKDIR /app COPY . . RUN bun install --frozen-lockfile && bun run radicale FROM alpine:edge RUN apk add --no-cache \ radicale py3-six\ && rm -rf /var/cache/apk/* \ \ && { \ echo '[root]'; \ echo 'user: .+'; \ echo 'collection:'; \ echo 'permissions: R'; \ echo; \ echo '[principal]'; \ echo 'user: .+'; \ echo 'collection: {user}'; \ echo 'permissions: R'; \ echo; \ echo '[collections]'; \ echo 'user: .+'; \ echo 'collection: {user}/[^/]+'; \ echo 'permissions: rR'; \ } > /etc/radicale/rights \ \ && { \ echo '[server]'; \ echo 'hosts = 0.0.0.0:5232, [::]:5232'; \ echo; \ echo '[auth]'; \ echo 'type = none'; \ echo; \ echo '[web]'; \ echo 'type = none'; \ echo; \ echo '[storage]'; \ echo 'type = multifilesystem'; \ echo 'filesystem_folder = /app/vcards'; \ echo; \ echo '[rights]'; \ echo 'type = from_file'; \ echo 'file = /etc/radicale/rights'; \ } > /etc/radicale/config COPY --from=builder /app/radicale/ios/ /app/vcards/collection-root/cn/ COPY --from=builder /app/radicale/macos/ /app/vcards/collection-root/cnmacos/ EXPOSE 5232 CMD ["radicale"]