Skip to content

Commit d0a1044

Browse files
Tinywanclaude
andcommitted
使用 S6 Overlay 替换 Supervisord
- 移除 supervisord 和 Python 依赖 - 使用 S6 Overlay v3 作为进程管理器(更轻量) - 创建 webman 服务配置 - 预计可减少约 10MB 镜像大小 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 80aeff2 commit d0a1044

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

Dockerfile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
FROM php:8.4.16-cli-alpine
22

33
LABEL Maintainer="ShaoBo Wan (Tinywan) <756684177@qq.com>" \
4-
Description="Webman Lightweight container with PHP 8.4.16 based on Alpine Linux."
4+
Description="Webman Lightweight container with PHP 8.4.16 based on Alpine Linux with S6 Overlay."
55

66
# Use Alibaba Cloud mirror for faster downloads
77
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
88

9+
# Install S6 Overlay v3
10+
ADD https://github.com/just-containers/s6-overlay/releases/download/v3.2.0.0/s6-overlay-noarch.tar.xz /tmp
11+
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && rm /tmp/s6-overlay-noarch.tar.xz
12+
ADD https://github.com/just-containers/s6-overlay/releases/download/v3.2.0.0/s6-overlay-x86_64.tar.xz /tmp
13+
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz && rm /tmp/s6-overlay-x86_64.tar.xz
14+
915
# Install runtime dependencies only (build deps will be installed and removed later)
10-
RUN apk add --no-cache curl ca-certificates tzdata supervisor
16+
RUN apk add --no-cache curl ca-certificates tzdata
1117

1218
COPY ./extension /tmp/extension
1319
WORKDIR /tmp/extension
@@ -31,14 +37,20 @@ RUN curl -sS https://getcomposer.org/installer | php \
3137
# Configure PHP
3238
COPY config/php.ini /usr/local/etc/php/conf.d/zzz_custom.ini
3339

34-
# Configure supervisord
35-
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
40+
# Setup S6 Overlay services
41+
COPY config/s6/ /etc/s6-overlay/
42+
43+
# Make scripts executable
44+
RUN chmod +x /etc/s6-overlay/cont-init.d/* \
45+
&& chmod +x /etc/s6-overlay/services/*/run 2>/dev/null || true
3646

3747
# Setup document root
3848
RUN mkdir -p /app
3949

50+
# Set S6 Overlay as entrypoint
51+
ENTRYPOINT ["/init"]
4052
VOLUME /app
4153
WORKDIR /app
4254
EXPOSE 8787
4355

44-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
56+
CMD []

config/s6/services/webman/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
# Webman service - S6 Overlay
3+
4+
cd /app
5+
exec php start.php start

0 commit comments

Comments
 (0)