Skip to content

Commit e794c9d

Browse files
committed
fix
1 parent c273aac commit e794c9d

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

.github/workflows/buld-docker-image.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ name: 📦 Build CTX Binary
33
on:
44
release:
55
types:
6-
- published
7-
pull_request:
8-
branches:
9-
- main
6+
- created
107

118
jobs:
129
build-image:
@@ -23,21 +20,21 @@ jobs:
2320
platforms: arm64,amd64
2421

2522
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v2
23+
id: buildx
24+
uses: docker/setup-buildx-action@v3
2725

2826
- name: Login to GitHub Container Registry
29-
if: github.event_name == 'release'
3027
uses: docker/login-action@v3
3128
with:
3229
registry: ghcr.io
33-
username: ${{ github.actor }}
34-
password: ${{ secrets.GITHUB_TOKEN }}
30+
username: ${{ secrets.GHCR_LOGIN }}
31+
password: ${{ secrets.GHCR_PASSWORD }}
3532

3633
- name: Extract metadata for Builder Image
3734
id: builder-metadata
3835
uses: docker/metadata-action@v5
3936
with:
40-
images: ghcr.io/${{ github.repository }}/php-builder
37+
images: ghcr.io/${{ github.repository }}/bin-builder
4138
tags: |
4239
type=ref,event=branch
4340
type=ref,event=pr
@@ -49,7 +46,7 @@ jobs:
4946
with:
5047
context: .
5148
platforms: linux/amd64,linux/arm64
52-
push: ${{ github.event_name == 'release' }}
49+
push: true
5350
tags: ${{ steps.builder-metadata.outputs.tags }}
5451
labels: ${{ steps.builder-metadata.outputs.labels }}
5552
cache-from: type=gha,scope=builder-image

Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ WORKDIR /build-tools
2020

2121
# Clone and set up static-php-cli from source
2222
RUN git clone https://github.com/crazywhalecc/static-php-cli.git
23-
RUN cd static-php-cli
24-
RUN composer install --no-dev --prefer-dist --ignore-platform-reqs
25-
RUN chmod +x bin/spc
23+
RUN composer install -d /build-tools/static-php-cli
24+
RUN chmod +x static-php-cli/bin/spc
2625

2726
# Download box tool for PHAR creation
2827
RUN wget -O /usr/local/bin/box "https://github.com/box-project/box/releases/download/4.6.6/box.phar" \
@@ -54,10 +53,7 @@ RUN cd /build-tools/static-php-cli && \
5453
--with-upx-pack
5554

5655
# Copy the micro.sfx to a known location for later reuse
57-
RUN cp /build-tools/static-php-cli/buildroot/micro.sfx /build-tools/build/bin/
58-
59-
# Set up Composer
60-
COPY --from=composer:2.8.4 /usr/bin/composer /usr/bin/composer
56+
RUN cp /build-tools/static-php-cli/buildroot/bin/micro.sfx /build-tools/build/bin/
6157

6258
# Default command to display info
6359
CMD ["echo", "PHP Builder image is ready for use"]

Dockerfile.windows

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use Windows Server Core as the base image
2-
FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS builder
2+
FROM mcr.microsoft.com/windows/servercore:ltsc2025 AS builder
33

44
# Define build arguments
55
ARG VERSION="latest"
@@ -28,9 +28,9 @@ RUN Invoke-WebRequest -Uri "https://github.com/box-project/box/releases/download
2828
RUN Invoke-WebRequest -Uri "https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe" -OutFile ".build/bin/spc.exe"
2929

3030
# Download required PHP extensions
31-
RUN .build/bin/spc.exe download micro `
32-
--for-extensions=ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,tokenizer,xml,xmlwriter,curl `
33-
--with-php=8.3 `
31+
RUN .build/bin/spc.exe download micro \
32+
--for-extensions=ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,tokenizer,xml,xmlwriter,curl \
33+
--with-php=8.3 \
3434
--prefer-pre-built
3535

3636
# Install UPX for compression
@@ -40,8 +40,8 @@ RUN .build/bin/spc.exe install-pkg upx
4040
RUN .build/bin/spc.exe doctor --auto-fix
4141

4242
# Build the self-executable binary with required extensions
43-
RUN .build/bin/spc.exe build "ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,tokenizer,xml,xmlwriter,curl" `
44-
--build-micro `
43+
RUN .build/bin/spc.exe build "ctype,dom,filter,libxml,mbstring,phar,simplexml,sockets,tokenizer,xml,xmlwriter,curl" \
44+
--build-micro \
4545
--with-upx-pack
4646

4747
# Default command to display info

0 commit comments

Comments
 (0)