Skip to content

Commit abff9b9

Browse files
committed
init
0 parents  commit abff9b9

50 files changed

Lines changed: 11557 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
APP_NAME=skeleton
2+
APP_ENV=dev
3+
4+
DB_DRIVER=mysql
5+
DB_HOST=localhost
6+
DB_PORT=3306
7+
DB_DATABASE=hyperf
8+
DB_USERNAME=root
9+
DB_PASSWORD=
10+
DB_CHARSET=utf8mb4
11+
DB_COLLATION=utf8mb4_unicode_ci
12+
DB_PREFIX=
13+
14+
REDIS_HOST=localhost
15+
REDIS_AUTH=(null)
16+
REDIS_PORT=6379
17+
REDIS_DB=0

.github/workflows/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Default Dockerfile
2+
#
3+
# @link https://www.hyperf.io
4+
# @document https://hyperf.wiki
5+
# @contact group@hyperf.io
6+
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
7+
8+
FROM hyperf/hyperf:8.0-alpine-v3.16-swoole
9+
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
10+
11+
##
12+
# ---------- env settings ----------
13+
##
14+
# --build-arg timezone=Asia/Shanghai
15+
ARG timezone
16+
17+
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
18+
APP_ENV=prod \
19+
SCAN_CACHEABLE=(true)
20+
21+
# update
22+
RUN set -ex \
23+
# show php version and extensions
24+
&& php -v \
25+
&& php -m \
26+
&& php --ri swoole \
27+
# ---------- some config ----------
28+
&& cd /etc/php* \
29+
# - config PHP
30+
&& { \
31+
echo "upload_max_filesize=128M"; \
32+
echo "post_max_size=128M"; \
33+
echo "memory_limit=1G"; \
34+
echo "date.timezone=${TIMEZONE}"; \
35+
} | tee conf.d/99_overrides.ini \
36+
# - config timezone
37+
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
38+
&& echo "${TIMEZONE}" > /etc/timezone \
39+
# ---------- clear works ----------
40+
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
41+
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
42+
43+
WORKDIR /opt/www
44+
45+
# Composer Cache
46+
# COPY ./composer.* /opt/www/
47+
# RUN composer install --no-dev --no-scripts
48+
49+
COPY . /opt/www
50+
RUN print "\n" | composer install -o && php bin/hyperf.php
51+
52+
EXPOSE 9501
53+
54+
ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Build Docker
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v2
11+
- name: Build
12+
run: cp -rf .github/workflows/Dockerfile . && docker build -t hyperf .

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: Release
8+
9+
jobs:
10+
release:
11+
name: Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Create Release
17+
id: create_release
18+
uses: actions/create-release@v1
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
tag_name: ${{ github.ref }}
23+
release_name: Release ${{ github.ref }}
24+
draft: false
25+
prerelease: false

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.buildpath
2+
.settings/
3+
.project
4+
*.patch
5+
.idea/
6+
.git/
7+
runtime/
8+
vendor/
9+
.phpintel/
10+
.env
11+
.DS_Store
12+
.phpunit*
13+
*.cache
14+
.vscode/

.gitlab-ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# usermod -aG docker gitlab-runner
2+
3+
stages:
4+
- build
5+
- deploy
6+
7+
variables:
8+
PROJECT_NAME: hyperf
9+
REGISTRY_URL: registry-docker.org
10+
11+
build_test_docker:
12+
stage: build
13+
before_script:
14+
# - git submodule sync --recursive
15+
# - git submodule update --init --recursive
16+
script:
17+
- docker build . -t $PROJECT_NAME
18+
- docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:test
19+
- docker push $REGISTRY_URL/$PROJECT_NAME:test
20+
only:
21+
- test
22+
tags:
23+
- builder
24+
25+
deploy_test_docker:
26+
stage: deploy
27+
script:
28+
- docker stack deploy -c deploy.test.yml --with-registry-auth $PROJECT_NAME
29+
only:
30+
- test
31+
tags:
32+
- test
33+
34+
build_docker:
35+
stage: build
36+
before_script:
37+
# - git submodule sync --recursive
38+
# - git submodule update --init --recursive
39+
script:
40+
- docker build . -t $PROJECT_NAME
41+
- docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:$CI_COMMIT_REF_NAME
42+
- docker tag $PROJECT_NAME $REGISTRY_URL/$PROJECT_NAME:latest
43+
- docker push $REGISTRY_URL/$PROJECT_NAME:$CI_COMMIT_REF_NAME
44+
- docker push $REGISTRY_URL/$PROJECT_NAME:latest
45+
only:
46+
- tags
47+
tags:
48+
- builder
49+
50+
deploy_docker:
51+
stage: deploy
52+
script:
53+
- echo SUCCESS
54+
only:
55+
- tags
56+
tags:
57+
- builder

.php-cs-fixer.php

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf.
6+
*
7+
* @link https://www.hyperf.io
8+
* @document https://hyperf.wiki
9+
* @contact group@hyperf.io
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+
*/
12+
$header = <<<'EOF'
13+
This file is part of Hyperf.
14+
15+
@link https://www.hyperf.io
16+
@document https://hyperf.wiki
17+
@contact group@hyperf.io
18+
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
19+
EOF;
20+
21+
return (new PhpCsFixer\Config())
22+
->setRiskyAllowed(true)
23+
->setRules([
24+
'@PSR2' => true,
25+
'@Symfony' => true,
26+
'@DoctrineAnnotation' => true,
27+
'@PhpCsFixer' => true,
28+
'header_comment' => [
29+
'comment_type' => 'PHPDoc',
30+
'header' => $header,
31+
'separate' => 'none',
32+
'location' => 'after_declare_strict',
33+
],
34+
'array_syntax' => [
35+
'syntax' => 'short',
36+
],
37+
'list_syntax' => [
38+
'syntax' => 'short',
39+
],
40+
'concat_space' => [
41+
'spacing' => 'one',
42+
],
43+
'global_namespace_import' => [
44+
'import_classes' => true,
45+
'import_constants' => true,
46+
'import_functions' => null,
47+
],
48+
'blank_line_before_statement' => [
49+
'statements' => [
50+
'declare',
51+
],
52+
],
53+
'general_phpdoc_annotation_remove' => [
54+
'annotations' => [
55+
'author',
56+
],
57+
],
58+
'ordered_imports' => [
59+
'imports_order' => [
60+
'class', 'function', 'const',
61+
],
62+
'sort_algorithm' => 'alpha',
63+
],
64+
'single_line_comment_style' => [
65+
'comment_types' => [
66+
],
67+
],
68+
'yoda_style' => [
69+
'always_move_variable' => false,
70+
'equal' => false,
71+
'identical' => false,
72+
],
73+
'phpdoc_align' => [
74+
'align' => 'left',
75+
],
76+
'multiline_whitespace_before_semicolons' => [
77+
'strategy' => 'no_multi_line',
78+
],
79+
'constant_case' => [
80+
'case' => 'lower',
81+
],
82+
'class_attributes_separation' => true,
83+
'combine_consecutive_unsets' => true,
84+
'declare_strict_types' => true,
85+
'linebreak_after_opening_tag' => true,
86+
'lowercase_static_reference' => true,
87+
'no_useless_else' => true,
88+
'no_unused_imports' => true,
89+
'not_operator_with_successor_space' => true,
90+
'not_operator_with_space' => false,
91+
'ordered_class_elements' => true,
92+
'php_unit_strict' => false,
93+
'phpdoc_separation' => false,
94+
'single_quote' => true,
95+
'standardize_not_equals' => true,
96+
'multiline_comment_opening_closing' => true,
97+
])
98+
->setFinder(
99+
PhpCsFixer\Finder::create()
100+
->exclude('public')
101+
->exclude('runtime')
102+
->exclude('vendor')
103+
->in(__DIR__)
104+
)
105+
->setUsingCache(false);

.phpstorm.meta.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace PHPSTORM_META {
4+
// Reflect
5+
override(\Psr\Container\ContainerInterface::get(0), map(['' => '@']));
6+
override(\Hyperf\Context\Context::get(0), map(['' => '@']));
7+
override(\make(0), map(['' => '@']));
8+
override(\di(0), map(['' => '@']));
9+
override(\Hyperf\Support\make(0), map(['' => '@']));
10+
override(\Hyperf\Support\optional(0), type(0));
11+
override(\Hyperf\Tappable\tap(0), type(0));
12+
}

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Default Dockerfile
2+
#
3+
# @link https://www.hyperf.io
4+
# @document https://hyperf.wiki
5+
# @contact group@hyperf.io
6+
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
7+
8+
FROM hyperf/hyperf:8.0-alpine-v3.16-swoole
9+
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
10+
11+
##
12+
# ---------- env settings ----------
13+
##
14+
# --build-arg timezone=Asia/Shanghai
15+
ARG timezone
16+
17+
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
18+
APP_ENV=prod \
19+
SCAN_CACHEABLE=(true)
20+
21+
# update
22+
RUN set -ex \
23+
# show php version and extensions
24+
&& php -v \
25+
&& php -m \
26+
&& php --ri swoole \
27+
# ---------- some config ----------
28+
&& cd /etc/php* \
29+
# - config PHP
30+
&& { \
31+
echo "upload_max_filesize=128M"; \
32+
echo "post_max_size=128M"; \
33+
echo "memory_limit=1G"; \
34+
echo "date.timezone=${TIMEZONE}"; \
35+
} | tee conf.d/99_overrides.ini \
36+
# - config timezone
37+
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
38+
&& echo "${TIMEZONE}" > /etc/timezone \
39+
# ---------- clear works ----------
40+
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
41+
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
42+
43+
WORKDIR /opt/www
44+
45+
# Composer Cache
46+
# COPY ./composer.* /opt/www/
47+
# RUN composer install --no-dev --no-scripts
48+
49+
COPY . /opt/www
50+
RUN composer install --no-dev -o && php bin/hyperf.php
51+
52+
EXPOSE 9501
53+
54+
ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Hyperf
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)