Skip to content

Commit cf73ccc

Browse files
committed
Multiple versions
1 parent fcfb9d0 commit cf73ccc

File tree

4 files changed

+172
-27
lines changed

4 files changed

+172
-27
lines changed

.github/workflows/docker-commit.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker
1+
name: Docker Commit
22

33
on:
44
push:
@@ -14,7 +14,13 @@ jobs:
1414

1515
runs-on: ubuntu-latest
1616

17-
name: Tag Commit (PHP-FPM)
17+
name: Tag Commit (PHP-FPM, ${{ matrix.base-tag }})
18+
19+
strategy:
20+
matrix:
21+
base-tag:
22+
- 7.4-fpm-alpine
23+
- 8.0-fpm-alpine
1824

1925
steps:
2026
- uses: actions/checkout@v2
@@ -37,15 +43,25 @@ jobs:
3743
with:
3844
push: true
3945
context: .
40-
tags: renokico/laravel-base:${{ github.sha }}-8.0-fpm-alpine
46+
tags: renokico/laravel-base:${{ github.sha }}-${{ matrix.base-tag }}
4147
file: Dockerfile.fpm
48+
build-args: |
49+
BASE_TAG=${{ matrix.base-tag }}
4250
4351
octane_push:
4452
if: "!contains(github.event.head_commit.message, 'skip ci')"
4553

4654
runs-on: ubuntu-latest
4755

48-
name: Tag Commit (Octane)
56+
name: Tag Commit (Octane, ${{ matrix.base-tag }})
57+
58+
strategy:
59+
matrix:
60+
base-tag:
61+
- 4.6-php8.0-alpine
62+
- 4.5-php8.0-alpine
63+
- 4.6-php7.4-alpine
64+
- 4.5-php7.4-alpine
4965

5066
steps:
5167
- uses: actions/checkout@v2
@@ -68,15 +84,23 @@ jobs:
6884
with:
6985
push: true
7086
context: .
71-
tags: renokico/laravel-base:octane-${{ github.sha }}-php8.0-alpine
87+
tags: renokico/laravel-base:octane-${{ github.sha }}-${{ matrix.base-tag }}
7288
file: Dockerfile.octane
89+
build-args: |
90+
BASE_TAG=${{ matrix.base-tag }}
7391
7492
worker_push:
7593
if: "!contains(github.event.head_commit.message, 'skip ci')"
7694

7795
runs-on: ubuntu-latest
7896

79-
name: Tag Commit (Worker)
97+
name: Tag Commit (Worker, ${{ matrix.base-tag }})
98+
99+
strategy:
100+
matrix:
101+
base-tag:
102+
- 8.0-cli-alpine
103+
- 7.4-cli-alpine
80104

81105
steps:
82106
- uses: actions/checkout@v2
@@ -99,5 +123,7 @@ jobs:
99123
with:
100124
push: true
101125
context: .
102-
tags: renokico/laravel-base:worker-${{ github.sha }}-8.0-cli-alpine
126+
tags: renokico/laravel-base:worker-${{ github.sha }}-${{ matrix.base-tag }}
103127
file: Dockerfile.worker
128+
build-args: |
129+
BASE_TAG=${{ matrix.base-tag }}

.github/workflows/docker-latest-tag.yaml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker
1+
name: Docker Latest
22

33
on:
44
push:
@@ -11,7 +11,13 @@ jobs:
1111

1212
runs-on: ubuntu-latest
1313

14-
name: Tag Latest (PHP-FPM)
14+
name: Tag Latest (PHP-FPM, ${{ matrix.base-tag }})
15+
16+
strategy:
17+
matrix:
18+
base-tag:
19+
- 7.4-fpm-alpine
20+
- 8.0-fpm-alpine
1521

1622
steps:
1723
- uses: actions/checkout@v2
@@ -34,16 +40,25 @@ jobs:
3440
with:
3541
push: true
3642
context: .
37-
tags: renokico/laravel-base:latest-8.0-fpm-alpine
38-
labels: ${{ steps.docker_meta.outputs.labels }}
43+
tags: renokico/laravel-base:latest-${{ matrix.base-tag }}
3944
file: Dockerfile.fpm
45+
build-args: |
46+
BASE_TAG=${{ matrix.base-tag }}
4047
4148
push_octane:
4249
if: "!contains(github.event.head_commit.message, 'skip ci')"
4350

4451
runs-on: ubuntu-latest
4552

46-
name: Tag Latest (Octane)
53+
name: Tag Latest (Octane, ${{ matrix.base-tag }})
54+
55+
strategy:
56+
matrix:
57+
base-tag:
58+
- 4.6-php8.0-alpine
59+
- 4.5-php8.0-alpine
60+
- 4.6-php7.4-alpine
61+
- 4.5-php7.4-alpine
4762

4863
steps:
4964
- uses: actions/checkout@v2
@@ -66,16 +81,23 @@ jobs:
6681
with:
6782
push: true
6883
context: .
69-
tags: renokico/laravel-base:octane-latest-php8.0-alpine
70-
labels: ${{ steps.docker_meta.outputs.labels }}
84+
tags: renokico/laravel-base:octane-latest-${{ matrix.base-tag }}
7185
file: Dockerfile.octane
86+
build-args: |
87+
BASE_TAG=${{ matrix.base-tag }}
7288
7389
push_worker:
7490
if: "!contains(github.event.head_commit.message, 'skip ci')"
7591

7692
runs-on: ubuntu-latest
7793

78-
name: Tag Latest (Worker)
94+
name: Tag Latest (Worker, ${{ matrix.base-tag }})
95+
96+
strategy:
97+
matrix:
98+
base-tag:
99+
- 8.0-cli-alpine
100+
- 7.4-cli-alpine
79101

80102
steps:
81103
- uses: actions/checkout@v2
@@ -98,6 +120,7 @@ jobs:
98120
with:
99121
push: true
100122
context: .
101-
tags: renokico/laravel-base:worker-latest-8.0-cli-alpine
102-
labels: ${{ steps.docker_meta.outputs.labels }}
123+
tags: renokico/laravel-base:worker-latest-${{ matrix.base-tag }}
103124
file: Dockerfile.worker
125+
build-args: |
126+
BASE_TAG=${{ matrix.base-tag }}

.github/workflows/docker-release-tag.yaml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker
1+
name: Docker Release
22

33
on:
44
push:
@@ -11,7 +11,13 @@ jobs:
1111

1212
runs-on: ubuntu-latest
1313

14-
name: Tag Release (PHP-FPM)
14+
name: Tag Release (PHP-FPM, ${{ matrix.base-tag }})
15+
16+
strategy:
17+
matrix:
18+
base-tag:
19+
- 7.4-fpm-alpine
20+
- 8.0-fpm-alpine
1521

1622
steps:
1723
- uses: actions/checkout@v2
@@ -22,8 +28,8 @@ jobs:
2228
with:
2329
images: renokico/laravel-base
2430
tags: |
25-
type=semver,pattern={{version}}-8.0-fpm-alpine
26-
type=semver,pattern={{major}}.{{minor}}-8.0-fpm-alpine
31+
type=semver,pattern={{version}}-${{ matrix.base-tag }}
32+
type=semver,pattern={{major}}.{{minor}}-${{ matrix.base-tag }}
2733
2834
- name: Set up QEMU
2935
uses: docker/setup-qemu-action@v1
@@ -46,13 +52,23 @@ jobs:
4652
tags: ${{ steps.docker_meta.outputs.tags }}
4753
labels: ${{ steps.docker_meta.outputs.labels }}
4854
file: Dockerfile.fpm
55+
build-args: |
56+
BASE_TAG=${{ matrix.base-tag }}
4957
5058
push_octane:
5159
if: "!contains(github.event.head_commit.message, 'skip ci')"
5260

5361
runs-on: ubuntu-latest
5462

55-
name: Tag Release (Octane)
63+
name: Tag Release (Octane, ${{ matrix.base-tag }})
64+
65+
strategy:
66+
matrix:
67+
base-tag:
68+
- 4.6-php8.0-alpine
69+
- 4.5-php8.0-alpine
70+
- 4.6-php7.4-alpine
71+
- 4.5-php7.4-alpine
5672

5773
steps:
5874
- uses: actions/checkout@v2
@@ -63,8 +79,8 @@ jobs:
6379
with:
6480
images: renokico/laravel-base
6581
tags: |
66-
type=semver,pattern=octane-{{version}}-php8.0-alpine
67-
type=semver,pattern=octane-{{major}}.{{minor}}-php8.0-alpine
82+
type=semver,pattern=octane-{{version}}-${{ matrix.base-tag }}
83+
type=semver,pattern=octane-{{major}}.{{minor}}-${{ matrix.base-tag }}
6884
6985
- name: Set up QEMU
7086
uses: docker/setup-qemu-action@v1
@@ -87,13 +103,21 @@ jobs:
87103
tags: ${{ steps.docker_meta.outputs.tags }}
88104
labels: ${{ steps.docker_meta.outputs.labels }}
89105
file: Dockerfile.octane
106+
build-args: |
107+
BASE_TAG=${{ matrix.base-tag }}
90108
91109
push_worker:
92110
if: "!contains(github.event.head_commit.message, 'skip ci')"
93111

94112
runs-on: ubuntu-latest
95113

96-
name: Tag Release (Worker)
114+
name: Tag Release (Worker, ${{ matrix.base-tag }})
115+
116+
strategy:
117+
matrix:
118+
base-tag:
119+
- 8.0-cli-alpine
120+
- 7.4-cli-alpine
97121

98122
steps:
99123
- uses: actions/checkout@v2
@@ -104,8 +128,8 @@ jobs:
104128
with:
105129
images: renokico/laravel-base
106130
tags: |
107-
type=semver,pattern=worker-{{version}}-8.0-cli-alpine
108-
type=semver,pattern=worker-{{major}}.{{minor}}-8.0-cli-alpine
131+
type=semver,pattern=worker-{{version}}-${{ matrix.base-tag }}
132+
type=semver,pattern=worker-{{major}}.{{minor}}-${{ matrix.base-tag }}
109133
110134
- name: Set up QEMU
111135
uses: docker/setup-qemu-action@v1
@@ -128,3 +152,5 @@ jobs:
128152
tags: ${{ steps.docker_meta.outputs.tags }}
129153
labels: ${{ steps.docker_meta.outputs.labels }}
130154
file: Dockerfile.worker
155+
build-args: |
156+
BASE_TAG=${{ matrix.base-tag }}

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Laravel Docker Images
2+
=====================
3+
4+
- [Laravel Docker Images](#laravel-docker-images)
5+
- [⛽ Octane](#-octane)
6+
- [🖥 PHP-FPM](#-php-fpm)
7+
- [🤖 Workers](#-workers)
8+
9+
Already-compiled PHP-based Images to use when deploying your Laravel application to Kubernetes using Laravel Helm charts.
10+
11+
Images are used to deploy a [sample Laravel application](https://github.com/renoki-co/laravel-helm-demo) to Kubernetes using Helm charts for vanilla Laravel, Laravel Octane or to deploy workers such as queues.
12+
13+
This project compiles images:
14+
15+
- for PHP-FPM + NGINX projects, using `Dockerfile.fpm`, based on an official PHP-FPM Docker image
16+
- for Octane, using `Dockerfile.octane`, based on [a PHP, Swoole-ready image](https://hub.docker.com/r/phpswoole/swoole)
17+
- for Workers, like CLI commands, using `Dockerfile.worker`, based on an official PHP CLI Docker image
18+
19+
These images can be used to compile your app code in a PHP-ready container to be used in Kubernetes:
20+
21+
## ⛽ Octane
22+
23+
Octane images are based on [a PHP-Swoole image](https://hub.docker.com/r/phpswoole/swoole) that works directly with Octane in Swoole mode.
24+
25+
```Dockerfile
26+
FROM renokico/laravel-base:octane-latest-php8.0-alpine
27+
28+
COPY . /var/www/html
29+
30+
RUN mkdir -p /var/www/html/storage/logs/ && \
31+
chown -R www-data:www-data /var/www/html
32+
33+
WORKDIR /var/www/html
34+
35+
ENTRYPOINT ["php", "-d", "variables_order=EGPCS", "artisan", "octane:start", "--server=swoole", "--host=0.0.0.0", "--port=80"]
36+
37+
EXPOSE 80
38+
```
39+
40+
## 🖥 PHP-FPM
41+
42+
The PHP-FPM image contains the PHP-FPM process and will be complemented by NGINX in the Helm chart.
43+
44+
```Dockerfile
45+
FROM renokico/laravel-base:latest-8.0-fpm-alpine
46+
47+
COPY . /var/www/html
48+
49+
RUN mkdir -p /var/www/html/storage/logs/ && \
50+
chown -R www-data:www-data /var/www/html
51+
52+
WORKDIR /var/www/html
53+
```
54+
55+
## 🤖 Workers
56+
57+
Workers can be either long-running processes that serve as workers (for example, queues) or by running a local process that might also expose a HTTP server, etc. Either way, you can use a Worker to extend your project.
58+
59+
```Dockerfile
60+
FROM renokico/laravel-base:worker-latest-8.0-cli-alpine
61+
62+
COPY . /var/www/html
63+
64+
RUN mkdir -p /var/www/html/storage/logs/ && \
65+
chown -R www-data:www-data /var/www/html
66+
67+
WORKDIR /var/www/html
68+
69+
ENTRYPOINT ["php", "-a"]
70+
```

0 commit comments

Comments
 (0)