Skip to content

Commit ae65713

Browse files
feat(dev): Dev Container
Add Dev Container option and promote latest versions
1 parent 584feaa commit ae65713

File tree

5 files changed

+75
-24
lines changed

5 files changed

+75
-24
lines changed

.devcontainer/Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Dev Container Dockerfile
2+
#
3+
# @link https://www.hyperf.io
4+
# @document https://hyperf.wiki
5+
6+
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
7+
8+
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole-slim-v5.1
9+
LABEL maintainer="Hyperf Developers <[email protected]>" 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=dev \
19+
SCAN_CACHEABLE=(false)
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 && php bin/hyperf.php
51+
52+
EXPOSE 9501

.devcontainer/devcontainer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"build": {
3+
"context": "..",
4+
"dockerfile": "./Dockerfile"
5+
},
6+
"forwardPorts": [9501]
7+
}

.github/workflows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

8-
FROM hyperf/hyperf:8.1-alpine-v3.18-swoole
8+
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole-slim-v5.1
99
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

8-
FROM hyperf/hyperf:8.1-alpine-v3.18-swoole
8+
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole-slim-v5.1
99
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##

phpunit.xml.dist

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="./test/bootstrap.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false">
11-
<testsuites>
12-
<testsuite name="Tests">
13-
<directory suffix="Test.php">./test</directory>
14-
</testsuite>
15-
</testsuites>
16-
<filter>
17-
<whitelist processUncoveredFilesFromWhitelist="true">
18-
<directory suffix=".php">./app</directory>
19-
</whitelist>
20-
</filter>
21-
<php>
22-
<env name="APP_ENV" value="testing" force="true"/>
23-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="./test/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Tests">
5+
<directory suffix="Test.php">./test</directory>
6+
</testsuite>
7+
</testsuites>
8+
<php>
9+
<env name="APP_ENV" value="testing" force="true"/>
10+
</php>
11+
<source>
12+
<include>
13+
<directory suffix=".php">./app</directory>
14+
</include>
15+
</source>
2416
</phpunit>

0 commit comments

Comments
 (0)