-
Notifications
You must be signed in to change notification settings - Fork 2
42 lines (37 loc) · 1.33 KB
/
docker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Docker
on:
push:
branches:
- 8.2.x
paths:
- '**/Dockerfile'
jobs:
push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image-variant: [ 'apache', 'cli', 'fpm', 'supervisor', 'dev' ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log into registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ secrets.DOCKER_REGISTRY_URL }} -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build and push the images
run: |
VERSION=${{ matrix.image-variant }}
PHP_SHORT_VERSION=8.2
PHP_VERSION=8.2.25
tmpName="image-$RANDOM"
cp -r fonts $VERSION/
docker build $VERSION --file $VERSION/Dockerfile --tag $tmpName --build-arg PHP_VERSION=$PHP_VERSION
if [ $? -ne 0 ]; then
echo "Docker build failed, for ${VERSION}-$PHP_VERSION"
exit 1
fi
IMAGE_ID=${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_USERNAME }}/${{ secrets.IMAGE_NAME }}
docker tag $tmpName $IMAGE_ID:${VERSION}-$PHP_VERSION
docker push $IMAGE_ID:${VERSION}-$PHP_VERSION
docker tag $tmpName $IMAGE_ID:${VERSION}-$PHP_SHORT_VERSION
docker push $IMAGE_ID:${VERSION}-$PHP_SHORT_VERSION