2026-05-18 16:10:05 +08:00
|
|
|
FROM docker.io/hyperf/hyperf:8.3-alpine-v3.19-swoole
|
|
|
|
|
|
|
|
|
|
LABEL org.opencontainers.image.title="datahub-backend" \
|
|
|
|
|
org.opencontainers.image.vendor="WPIC" \
|
|
|
|
|
org.opencontainers.image.licenses="MIT" \
|
|
|
|
|
org.opencontainers.image.source="https://192.168.30.181:3000/wpic-dev/datahub"
|
|
|
|
|
|
|
|
|
|
ARG TIMEZONE=Asia/Shanghai
|
|
|
|
|
ENV TIMEZONE=${TIMEZONE} \
|
2025-11-05 16:34:40 +08:00
|
|
|
APP_ENV=prod \
|
|
|
|
|
SCAN_CACHEABLE=(true)
|
|
|
|
|
|
2026-05-18 16:10:05 +08:00
|
|
|
RUN set -eux; \
|
|
|
|
|
php -v; php -m; php --ri swoole; \
|
|
|
|
|
cd /etc/php*; \
|
|
|
|
|
{ \
|
2025-11-05 16:34:40 +08:00
|
|
|
echo "upload_max_filesize=128M"; \
|
|
|
|
|
echo "post_max_size=128M"; \
|
|
|
|
|
echo "memory_limit=1G"; \
|
|
|
|
|
echo "date.timezone=${TIMEZONE}"; \
|
2026-05-18 16:10:05 +08:00
|
|
|
} | tee conf.d/99_overrides.ini; \
|
|
|
|
|
ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime; \
|
|
|
|
|
echo "${TIMEZONE}" > /etc/timezone; \
|
|
|
|
|
rm -rf /var/cache/apk/* /tmp/* /usr/share/man
|
2025-11-05 16:34:40 +08:00
|
|
|
|
|
|
|
|
WORKDIR /opt/www
|
|
|
|
|
|
2026-05-18 16:10:05 +08:00
|
|
|
COPY composer.json composer.lock ./
|
|
|
|
|
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --no-interaction
|
2025-11-05 16:34:40 +08:00
|
|
|
|
2026-05-18 16:10:05 +08:00
|
|
|
COPY . .
|
|
|
|
|
RUN composer dump-autoload --optimize --classmap-authoritative --no-dev
|
|
|
|
|
|
|
|
|
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
|
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
2025-11-05 16:34:40 +08:00
|
|
|
|
|
|
|
|
EXPOSE 9501
|
|
|
|
|
|
2026-05-18 16:10:05 +08:00
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
|
|
|
|
CMD wget -qO- http://127.0.0.1:9501/health || exit 1
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
|
|
CMD ["php", "/opt/www/bin/hyperf.php", "start"]
|