From ae65713bb44a1aee8a388dea92cc3ffbab23e58c Mon Sep 17 00:00:00 2001 From: Leo Cavalcante Date: Mon, 25 Mar 2024 09:28:13 +0800 Subject: [PATCH] feat(dev): Dev Container Add Dev Container option and promote latest versions --- .devcontainer/Dockerfile | 52 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 7 +++++ .github/workflows/Dockerfile | 2 +- Dockerfile | 2 +- phpunit.xml.dist | 36 +++++++++-------------- 5 files changed, 75 insertions(+), 24 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..b560b9d7 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,52 @@ +# Dev Container Dockerfile +# +# @link https://www.hyperf.io +# @document https://hyperf.wiki +# @contact group@hyperf.io +# @license https://github.com/hyperf/hyperf/blob/master/LICENSE + +FROM hyperf/hyperf:8.3-alpine-v3.19-swoole-slim-v5.1 +LABEL maintainer="Hyperf Developers " version="1.0" license="MIT" app.name="Hyperf" + +## +# ---------- env settings ---------- +## +# --build-arg timezone=Asia/Shanghai +ARG timezone + +ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \ + APP_ENV=dev \ + SCAN_CACHEABLE=(false) + +# update +RUN set -ex \ + # show php version and extensions + && php -v \ + && php -m \ + && php --ri swoole \ + # ---------- some config ---------- + && cd /etc/php* \ + # - config PHP + && { \ + echo "upload_max_filesize=128M"; \ + echo "post_max_size=128M"; \ + echo "memory_limit=1G"; \ + echo "date.timezone=${TIMEZONE}"; \ + } | tee conf.d/99_overrides.ini \ + # - config timezone + && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \ + && echo "${TIMEZONE}" > /etc/timezone \ + # ---------- clear works ---------- + && rm -rf /var/cache/apk/* /tmp/* /usr/share/man \ + && echo -e "\033[42;37m Build Completed :).\033[0m\n" + +WORKDIR /opt/www + +# Composer Cache +# COPY ./composer.* /opt/www/ +# RUN composer install --no-dev --no-scripts + +COPY . /opt/www +RUN composer install && php bin/hyperf.php + +EXPOSE 9501 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..c0d2f54c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,7 @@ +{ + "build": { + "context": "..", + "dockerfile": "./Dockerfile" + }, + "forwardPorts": [9501] +} diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile index 2bb0a00b..5de0bb94 100644 --- a/.github/workflows/Dockerfile +++ b/.github/workflows/Dockerfile @@ -5,7 +5,7 @@ # @contact group@hyperf.io # @license https://github.com/hyperf/hyperf/blob/master/LICENSE -FROM hyperf/hyperf:8.1-alpine-v3.18-swoole +FROM hyperf/hyperf:8.3-alpine-v3.19-swoole-slim-v5.1 LABEL maintainer="Hyperf Developers " version="1.0" license="MIT" app.name="Hyperf" ## diff --git a/Dockerfile b/Dockerfile index 58412b90..ee4f8f94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ # @contact group@hyperf.io # @license https://github.com/hyperf/hyperf/blob/master/LICENSE -FROM hyperf/hyperf:8.1-alpine-v3.18-swoole +FROM hyperf/hyperf:8.3-alpine-v3.19-swoole-slim-v5.1 LABEL maintainer="Hyperf Developers " version="1.0" license="MIT" app.name="Hyperf" ## diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 26454b5d..caaa1d25 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,16 @@ - - - - ./test - - - - - ./app - - - - - + + + + ./test + + + + + + + + ./app + +