Files
datahub/backend/Dockerfile
T
2026-05-18 16:33:05 +08:00

46 lines
1.4 KiB
Docker

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} \
APP_ENV=prod \
SCAN_CACHEABLE=(true)
RUN apk add --no-cache php83-intl php83-pspell
RUN set -eux; \
php -v; php -m; php --ri swoole; \
cd /etc/php*; \
{ \
echo "upload_max_filesize=128M"; \
echo "post_max_size=128M"; \
echo "memory_limit=2G"; \
echo "date.timezone=${TIMEZONE}"; \
} | 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
WORKDIR /var/www
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --no-interaction
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
EXPOSE 9501
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", "/var/www/bin/hyperf.php", "start"]