Skip to content

Commit a3c4d13

Browse files
authored
Update php version 8.4 (#138)
* Update Dockerfiles to PHP8.4 and add dev.Dockerfile to handle rootless local files * Update docker-composer file to local container * fix dev.Dockerfile to create home dir for composer
1 parent cf2f17c commit a3c4d13

File tree

5 files changed

+71
-5
lines changed

5 files changed

+71
-5
lines changed

.devcontainer/Dockerfile

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

8-
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
8+
FROM hyperf/hyperf:8.4-alpine-v3.21-swoole
99
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##

.github/workflows/Dockerfile

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

8-
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
8+
FROM hyperf/hyperf:8.4-alpine-v3.21-swoole
99
LABEL maintainer="Hyperf Developers <group@hyperf.io>" 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
# @contact group@hyperf.io
66
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
77

8-
FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
8+
FROM hyperf/hyperf:8.4-alpine-v3.21-swoole
99
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
1010

1111
##

dev.Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Local Dev 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.4-alpine-v3.21-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+
ARG UID=1000
17+
ARG GID=1000
18+
19+
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
20+
APP_ENV=dev \
21+
SCAN_CACHEABLE=(false)
22+
23+
# Make local user to avoid file permissions on runtime
24+
RUN addgroup -g ${GID} application && \
25+
adduser -S -D -u ${UID} -G application -s /bin/ash -h /home/application application
26+
27+
# update
28+
RUN set -ex \
29+
# show php version and extensions
30+
&& php -v \
31+
&& php -m \
32+
&& php --ri swoole \
33+
# ---------- some config ----------
34+
&& cd /etc/php* \
35+
# - config PHP
36+
&& { \
37+
echo "upload_max_filesize=128M"; \
38+
echo "post_max_size=128M"; \
39+
echo "memory_limit=1G"; \
40+
echo "date.timezone=${TIMEZONE}"; \
41+
} | tee conf.d/99_overrides.ini \
42+
# - config timezone
43+
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
44+
&& echo "${TIMEZONE}" > /etc/timezone \
45+
# ---------- clear works ----------
46+
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
47+
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
48+
49+
RUN chmod +x /usr/local/bin/composer
50+
51+
USER application
52+
53+
WORKDIR /opt/www
54+
55+
# Composer Cache
56+
# COPY ./composer.* /opt/www/
57+
# RUN composer install --no-dev --no-scripts
58+
59+
COPY . /opt/www
60+
RUN composer install --no-scripts
61+
62+
EXPOSE 9501
63+
64+
ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
version: '3'
21
services:
32
hyperf-skeleton:
43
container_name: hyperf-skeleton
54
image: hyperf-skeleton
65
build:
7-
context: .
6+
dockerfile: dev.Dockerfile
7+
args:
8+
UID: 1000
9+
GID: 1000
810
volumes:
911
- ./:/opt/www
1012
ports:

0 commit comments

Comments
 (0)