Skip to content

Commit eb792c6

Browse files
dirsmortexa
andauthored
Add Alpine-based Docker images (#77)
Co-authored-by: mortexa <[email protected]>
1 parent bd6a23a commit eb792c6

11 files changed

+896
-170
lines changed

.github/workflows/frankenphp-test.yml

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- '**.md'
1414

1515
jobs:
16-
build:
17-
name: Build and Run Docker image
16+
debian-build:
17+
name: Build and Run Debian-based Docker image
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: true
@@ -41,8 +41,8 @@ jobs:
4141
uses: actions/cache@v2
4242
with:
4343
path: ${{ steps.composer-cache.outputs.dir }}
44-
key: ${{ runner.os }}-composer-${{ matrix.setup }}
45-
restore-keys: ${{ runner.os }}-composer-
44+
key: "${{ runner.os }}-composer-${{ matrix.setup }}"
45+
restore-keys: "${{ runner.os }}-composer-"
4646

4747
- name: Create app directory
4848
run: mkdir -p /var/www
@@ -59,7 +59,7 @@ jobs:
5959
run: sudo cp -R FrankenPHP.Dockerfile .dockerignore deployment/ /var/www/app/
6060

6161
- name: Build image
62-
run: docker build -t app:local -f FrankenPHP.Dockerfile .
62+
run: docker build -t app:local --build-arg PHP_VERSION=${{ matrix.php }} -f FrankenPHP.Dockerfile .
6363
working-directory: /var/www/app
6464

6565
- name: Run the Docker container
@@ -71,3 +71,62 @@ jobs:
7171

7272
- name: Check application health
7373
run: curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000
74+
75+
alpine-build:
76+
name: Build and Run Alpine-based Docker image
77+
runs-on: ubuntu-latest
78+
strategy:
79+
fail-fast: true
80+
matrix:
81+
php: [ 8.2, 8.3 ]
82+
timeout-minutes: 15
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v2
86+
87+
- name: Setup PHP with Composer and extensions
88+
uses: shivammathur/setup-php@v2
89+
with:
90+
php-version: "${{ matrix.php }}"
91+
extensions: dom, curl, libxml, mbstring, zip
92+
tools: composer:v2
93+
coverage: none
94+
95+
- name: Get Composer cache directory
96+
id: composer-cache
97+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
98+
99+
- name: Cache PHP dependencies
100+
uses: actions/cache@v2
101+
with:
102+
path: ${{ steps.composer-cache.outputs.dir }}
103+
key: "${{ runner.os }}-composer-${{ matrix.setup }}"
104+
restore-keys: "${{ runner.os }}-composer-"
105+
106+
- name: Create app directory
107+
run: mkdir -p /var/www
108+
109+
- name: Install a fresh Laravel app
110+
run: sudo composer create-project laravel/laravel app
111+
working-directory: /var/www
112+
113+
- name: Install Laravel Octane
114+
run: sudo composer require laravel/octane
115+
working-directory: /var/www/app
116+
117+
- name: Copy required content to dockerize the app
118+
run: sudo cp -R FrankenPHP.Alpine.Dockerfile .dockerignore deployment/ /var/www/app/
119+
120+
- name: Build image
121+
run: docker build -t app:local --build-arg PHP_VERSION=${{ matrix.php }} -f FrankenPHP.Alpine.Dockerfile .
122+
working-directory: /var/www/app
123+
124+
- name: Run the Docker container
125+
run: docker run -d --rm -p 8000:8000 app:local
126+
working-directory: /var/www/app
127+
128+
- name: Wait for the container
129+
run: sleep 10s
130+
131+
- name: Check application health
132+
run: curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000

.github/workflows/roadrunner-test.yml

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- '**.md'
1414

1515
jobs:
16-
build:
17-
name: Build and Run Docker image
16+
debian-build:
17+
name: Build and Run Debian-based Docker image
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: true
@@ -41,8 +41,8 @@ jobs:
4141
uses: actions/cache@v2
4242
with:
4343
path: ${{ steps.composer-cache.outputs.dir }}
44-
key: ${{ runner.os }}-composer-${{ matrix.setup }}
45-
restore-keys: ${{ runner.os }}-composer-
44+
key: "${{ runner.os }}-composer-${{ matrix.setup }}"
45+
restore-keys: "${{ runner.os }}-composer-"
4646

4747
- name: Create app directory
4848
run: mkdir -p /var/www
@@ -59,7 +59,7 @@ jobs:
5959
run: sudo cp -R RoadRunner.Dockerfile .dockerignore deployment/ /var/www/app/
6060

6161
- name: Build image
62-
run: docker build -t app:local -f RoadRunner.Dockerfile .
62+
run: docker build -t app:local --build-arg PHP_VERSION=${{ matrix.php }} -f RoadRunner.Dockerfile .
6363
working-directory: /var/www/app
6464

6565
- name: Run the Docker container
@@ -71,3 +71,62 @@ jobs:
7171

7272
- name: Check application health
7373
run: curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000
74+
75+
alpine-build:
76+
name: Build and Run Alpine-based Docker image
77+
runs-on: ubuntu-latest
78+
strategy:
79+
fail-fast: true
80+
matrix:
81+
php: [ 8.2, 8.3 ]
82+
timeout-minutes: 15
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v2
86+
87+
- name: Setup PHP with Composer and extensions
88+
uses: shivammathur/setup-php@v2
89+
with:
90+
php-version: "${{ matrix.php }}"
91+
extensions: dom, curl, libxml, mbstring, zip
92+
tools: composer:v2
93+
coverage: none
94+
95+
- name: Get Composer cache directory
96+
id: composer-cache
97+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
98+
99+
- name: Cache PHP dependencies
100+
uses: actions/cache@v2
101+
with:
102+
path: ${{ steps.composer-cache.outputs.dir }}
103+
key: "${{ runner.os }}-composer-${{ matrix.setup }}"
104+
restore-keys: "${{ runner.os }}-composer-"
105+
106+
- name: Create app directory
107+
run: mkdir -p /var/www
108+
109+
- name: Install a fresh Laravel app
110+
run: sudo composer create-project laravel/laravel app
111+
working-directory: /var/www
112+
113+
- name: Install Laravel Octane
114+
run: sudo composer require laravel/octane spiral/roadrunner-cli spiral/roadrunner-http --with-all-dependencies
115+
working-directory: /var/www/app
116+
117+
- name: Copy required content to dockerize the app
118+
run: sudo cp -R RoadRunner.Alpine.Dockerfile .dockerignore deployment/ /var/www/app/
119+
120+
- name: Build image
121+
run: docker build -t app:local --build-arg PHP_VERSION=${{ matrix.php }} -f RoadRunner.Alpine.Dockerfile .
122+
working-directory: /var/www/app
123+
124+
- name: Run the Docker container
125+
run: docker run -d --rm -p 8000:8000 app:local
126+
working-directory: /var/www/app
127+
128+
- name: Wait for the container
129+
run: sleep 10s
130+
131+
- name: Check application health
132+
run: curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000

.github/workflows/swoole-test.yml

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- '**.md'
1414

1515
jobs:
16-
build:
17-
name: Build and Run Docker image
16+
debian-build:
17+
name: Build and Run Debian-based Docker image
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: true
@@ -41,8 +41,8 @@ jobs:
4141
uses: actions/cache@v2
4242
with:
4343
path: ${{ steps.composer-cache.outputs.dir }}
44-
key: ${{ runner.os }}-composer-${{ matrix.setup }}
45-
restore-keys: ${{ runner.os }}-composer-
44+
key: "${{ runner.os }}-composer-${{ matrix.setup }}"
45+
restore-keys: "${{ runner.os }}-composer-"
4646

4747
- name: Create app directory
4848
run: mkdir -p /var/www
@@ -59,7 +59,7 @@ jobs:
5959
run: sudo cp -R Swoole.Dockerfile .dockerignore deployment/ /var/www/app/
6060

6161
- name: Build image
62-
run: docker build -t app:local -f Swoole.Dockerfile .
62+
run: docker build -t app:local --build-arg PHP_VERSION=${{ matrix.php }} -f Swoole.Dockerfile .
6363
working-directory: /var/www/app
6464

6565
- name: Run the Docker container
@@ -71,3 +71,62 @@ jobs:
7171

7272
- name: Check application health
7373
run: curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000
74+
75+
alpine-build:
76+
name: Build and Run Alpine-based Docker image
77+
runs-on: ubuntu-latest
78+
strategy:
79+
fail-fast: true
80+
matrix:
81+
php: [ 8.2, 8.3 ]
82+
timeout-minutes: 15
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v2
86+
87+
- name: Setup PHP with Composer and extensions
88+
uses: shivammathur/setup-php@v2
89+
with:
90+
php-version: "${{ matrix.php }}"
91+
extensions: dom, curl, libxml, mbstring, zip
92+
tools: composer:v2
93+
coverage: none
94+
95+
- name: Get Composer cache directory
96+
id: composer-cache
97+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
98+
99+
- name: Cache PHP dependencies
100+
uses: actions/cache@v2
101+
with:
102+
path: ${{ steps.composer-cache.outputs.dir }}
103+
key: "${{ runner.os }}-composer-${{ matrix.setup }}"
104+
restore-keys: "${{ runner.os }}-composer-"
105+
106+
- name: Create app directory
107+
run: mkdir -p /var/www
108+
109+
- name: Install a fresh Laravel app
110+
run: sudo composer create-project laravel/laravel app
111+
working-directory: /var/www
112+
113+
- name: Install Laravel Octane
114+
run: sudo composer require laravel/octane
115+
working-directory: /var/www/app
116+
117+
- name: Copy required content to dockerize the app
118+
run: sudo cp -R Swoole.Alpine.Dockerfile .dockerignore deployment/ /var/www/app/
119+
120+
- name: Build image
121+
run: docker build -t app:local --build-arg PHP_VERSION=${{ matrix.php }} -f Swoole.Alpine.Dockerfile .
122+
working-directory: /var/www/app
123+
124+
- name: Run the Docker container
125+
run: docker run -d --rm -p 8000:8000 app:local
126+
working-directory: /var/www/app
127+
128+
- name: Wait for the container
129+
run: sleep 10s
130+
131+
- name: Check application health
132+
run: curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000

0 commit comments

Comments
 (0)