-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9d70ac4
Showing
48 changed files
with
10,584 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Dev Container Dockerfile | ||
# | ||
# @link https://www.hyperf.io | ||
# @document https://hyperf.wiki | ||
# @contact [email protected] | ||
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
|
||
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole | ||
LABEL maintainer="Hyperf Developers <[email protected]>" 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"build": { | ||
"context": "..", | ||
"dockerfile": "./Dockerfile" | ||
}, | ||
"forwardPorts": [9501] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
** | ||
!app/ | ||
!bin/ | ||
!config/ | ||
!composer.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
APP_NAME=skeleton | ||
APP_ENV=dev | ||
|
||
DB_DRIVER=mysql | ||
DB_HOST=localhost | ||
DB_PORT=3306 | ||
DB_DATABASE=hyperf | ||
DB_USERNAME=root | ||
DB_PASSWORD= | ||
DB_CHARSET=utf8mb4 | ||
DB_COLLATION=utf8mb4_unicode_ci | ||
DB_PREFIX= | ||
|
||
REDIS_HOST=localhost | ||
REDIS_AUTH=(null) | ||
REDIS_PORT=6379 | ||
REDIS_DB=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Default Dockerfile | ||
# | ||
# @link https://www.hyperf.io | ||
# @document https://hyperf.wiki | ||
# @contact [email protected] | ||
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
|
||
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole | ||
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf" | ||
|
||
## | ||
# ---------- env settings ---------- | ||
## | ||
# --build-arg timezone=Asia/Shanghai | ||
ARG timezone | ||
|
||
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \ | ||
APP_ENV=prod \ | ||
SCAN_CACHEABLE=(true) | ||
|
||
# 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 print "\n" | composer install -o && php bin/hyperf.php | ||
|
||
EXPOSE 9501 | ||
|
||
ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Build Docker | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Build | ||
run: cp -rf .github/workflows/Dockerfile . && docker build -t hyperf . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Release | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.buildpath | ||
.settings/ | ||
.project | ||
*.patch | ||
.idea/ | ||
.git/ | ||
runtime/ | ||
vendor/ | ||
.phpintel/ | ||
.env | ||
.DS_Store | ||
.phpunit* | ||
*.cache | ||
.vscode/ | ||
/phpstan.neon | ||
/phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# usermod -aG docker gitlab-runner | ||
|
||
stages: | ||
- build | ||
- deploy | ||
|
||
variables: | ||
PROJECT_NAME: hyperf | ||
REGISTRY_URL: registry-docker.org | ||
|
||
build_test_docker: | ||
stage: build | ||
before_script: | ||
# - git submodule sync --recursive | ||
# - git submodule update --init --recursive | ||
script: | ||
- docker build . -t $PROJECT_NAME | ||
- docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:test | ||
- docker push $REGISTRY_URL/$PROJECT_NAME:test | ||
only: | ||
- test | ||
tags: | ||
- builder | ||
|
||
deploy_test_docker: | ||
stage: deploy | ||
script: | ||
- docker stack deploy -c deploy.test.yml --with-registry-auth $PROJECT_NAME | ||
only: | ||
- test | ||
tags: | ||
- test | ||
|
||
build_docker: | ||
stage: build | ||
before_script: | ||
# - git submodule sync --recursive | ||
# - git submodule update --init --recursive | ||
script: | ||
- docker build . -t $PROJECT_NAME | ||
- docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:$CI_COMMIT_REF_NAME | ||
- docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:latest | ||
- docker push $REGISTRY_URL/$PROJECT_NAME:$CI_COMMIT_REF_NAME | ||
- docker push $REGISTRY_URL/$PROJECT_NAME:latest | ||
only: | ||
- tags | ||
tags: | ||
- builder | ||
|
||
deploy_docker: | ||
stage: deploy | ||
script: | ||
- echo SUCCESS | ||
only: | ||
- tags | ||
tags: | ||
- builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
$header = <<<'EOF' | ||
This file is part of Hyperf. | ||
@link https://www.hyperf.io | ||
@document https://hyperf.wiki | ||
@contact [email protected] | ||
@license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
EOF; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'@DoctrineAnnotation' => true, | ||
'@PhpCsFixer' => true, | ||
'header_comment' => [ | ||
'comment_type' => 'PHPDoc', | ||
'header' => $header, | ||
'separate' => 'none', | ||
'location' => 'after_declare_strict', | ||
], | ||
'array_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'list_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'concat_space' => [ | ||
'spacing' => 'one', | ||
], | ||
'global_namespace_import' => [ | ||
'import_classes' => true, | ||
'import_constants' => true, | ||
'import_functions' => null, | ||
], | ||
'blank_line_before_statement' => [ | ||
'statements' => [ | ||
'declare', | ||
], | ||
], | ||
'general_phpdoc_annotation_remove' => [ | ||
'annotations' => [ | ||
'author', | ||
], | ||
], | ||
'ordered_imports' => [ | ||
'imports_order' => [ | ||
'class', 'function', 'const', | ||
], | ||
'sort_algorithm' => 'alpha', | ||
], | ||
'single_line_comment_style' => [ | ||
'comment_types' => [ | ||
], | ||
], | ||
'yoda_style' => [ | ||
'always_move_variable' => false, | ||
'equal' => false, | ||
'identical' => false, | ||
], | ||
'phpdoc_align' => [ | ||
'align' => 'left', | ||
], | ||
'multiline_whitespace_before_semicolons' => [ | ||
'strategy' => 'no_multi_line', | ||
], | ||
'constant_case' => [ | ||
'case' => 'lower', | ||
], | ||
'class_attributes_separation' => true, | ||
'combine_consecutive_unsets' => true, | ||
'declare_strict_types' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'lowercase_static_reference' => true, | ||
'no_useless_else' => true, | ||
'no_unused_imports' => true, | ||
'not_operator_with_successor_space' => true, | ||
'not_operator_with_space' => false, | ||
'ordered_class_elements' => true, | ||
'php_unit_strict' => false, | ||
'phpdoc_separation' => false, | ||
'single_quote' => true, | ||
'standardize_not_equals' => true, | ||
'multiline_comment_opening_closing' => true, | ||
'single_line_empty_body' => false, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->exclude('public') | ||
->exclude('runtime') | ||
->exclude('vendor') | ||
->in(__DIR__) | ||
) | ||
->setUsingCache(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace PHPSTORM_META { | ||
// Reflect | ||
override(\Psr\Container\ContainerInterface::get(0), map(['' => '@'])); | ||
override(\Hyperf\Context\Context::get(0), map(['' => '@'])); | ||
override(\make(0), map(['' => '@'])); | ||
override(\di(0), map(['' => '@'])); | ||
override(\Hyperf\Support\make(0), map(['' => '@'])); | ||
override(\Hyperf\Support\optional(0), type(0)); | ||
override(\Hyperf\Tappable\tap(0), type(0)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\Watcher\Driver\ScanFileDriver; | ||
|
||
return [ | ||
'driver' => ScanFileDriver::class, | ||
'bin' => PHP_BINARY, | ||
'watch' => [ | ||
'dir' => ['app', 'config'], | ||
'file' => ['.env'], | ||
'scan_interval' => 2000, | ||
], | ||
'ext' => ['.php', '.env'], | ||
]; |
Oops, something went wrong.