Skip to content

Commit 64bdc1e

Browse files
authored
Merge pull request #1608 from SKB-TECH/Fix_Daily_Image_Docker
feat(docker): add multi-platform daily builds
2 parents 30d403c + d9465bf commit 64bdc1e

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

.github/workflows/Daily-Image.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,40 @@ name: Build Daily Image
33
on:
44
schedule:
55
- cron: "0 0 * * *"
6+
67
jobs:
78
build-and-push:
89
if: github.repository_owner == 'cypht-org'
910
runs-on: ubuntu-latest
1011

1112
steps:
12-
- name: Checkout repository
13-
uses: actions/checkout@v3
14-
with:
15-
fetch-depth: 0
13+
- name: Checkout
14+
uses: actions/checkout@v4
1615

17-
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v2
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v2
1918

19+
- name: Set up Buildx
20+
uses: docker/setup-buildx-action@v3
21+
with:
22+
platforms: linux/amd64,linux/arm64,linux/arm/v7
2023

2124
- name: Log in to Docker Hub
22-
uses: docker/login-action@v2
25+
uses: docker/login-action@v3
2326
with:
2427
username: ${{ secrets.DOCKER_USERNAME }}
2528
password: ${{ secrets.DOCKER_PASSWORD }}
2629

27-
- name: Build and push Docker image
28-
uses: docker/build-push-action@v4
30+
- name: Build and push
31+
uses: docker/build-push-action@v5
2932
with:
3033
context: .
31-
platforms: linux/amd64
3234
file: ./docker/Dockerfile
35+
platforms: linux/amd64,linux/arm64,linux/arm/v7
3336
push: true
3437
tags: cypht/cypht:daily
35-
debug: true
38+
cache-from: type=registry,ref=cypht/cypht:buildcache
39+
cache-to: type=registry,ref=cypht/cypht:buildcache,mode=max
3640

3741
- name: Log out from Docker Hub
3842
run: docker logout

docker/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
FROM php:8.1-fpm-bookworm
1+
FROM --platform=$BUILDPLATFORM php:8.1-fpm-bookworm
22

33
WORKDIR /usr/local/share/cypht
44

5-
ENV DEBIAN_FRONTEND=noninteractive
6-
ENV COMPOSER_CACHE_DIR=/tmp/composer_cache
7-
ENV COMPOSER_HOME=/tmp/composer_home
5+
ENV DEBIAN_FRONTEND=noninteractive \
6+
COMPOSER_CACHE_DIR=/tmp/composer_cache \
7+
COMPOSER_HOME=/tmp/composer_home
88

99
# Install system packages and PHP extensions
10-
RUN set -e \
10+
RUN --mount=type=cache,target=/var/cache/apt \
11+
set -eux \
1112
&& apt-get update \
12-
&& apt-get install -y \
13+
&& apt-get install -y --no-install-recommends \
1314
supervisor \
1415
nginx \
1516
sqlite3 \
@@ -21,8 +22,9 @@ RUN set -e \
2122
libpq-dev \
2223
unzip \
2324
ca-certificates \
24-
&& docker-php-ext-configure gd \
25-
&& docker-php-ext-install \
25+
curl \
26+
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
27+
&& docker-php-ext-install -j$(nproc) \
2628
session \
2729
fileinfo \
2830
dom \
@@ -35,12 +37,10 @@ RUN set -e \
3537
mysqli \
3638
pgsql \
3739
soap \
38-
&& docker-php-ext-configure zip \
39-
&& docker-php-ext-install zip \
40+
zip \
4041
&& curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s \
4142
xdebug redis gnupg memcached ldap \
4243
&& rm -rf /var/lib/apt/lists/* \
43-
&& apt-get clean \
4444
&& mkdir -p /var/log/php /var/log/supervisord \
4545
&& ln -sf /dev/stdout /var/log/nginx/access.log \
4646
&& ln -sf /dev/stderr /var/log/nginx/error.log \

docker/xdebug.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[xdebug]
2+
zend_extension=xdebug.so
3+
xdebug.mode=debug
4+
xdebug.client_host=host.docker.internal

0 commit comments

Comments
 (0)