feat: update to php:8.3.3 #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**/Dockerfile' | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
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: | | |
for dockerFilePath in $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} ${{ github.event.before }} | grep "Dockerfile"); | |
do | |
folder=${dockerFilePath%"/Dockerfile"} | |
VERSION=${folder##*/} | |
PHP_VERSION=8.3.3 | |
tmpName="image-$RANDOM" | |
docker build $folder --file $folder/Dockerfile --tag $tmpName --build-arg PHP_VERSION=$PHP_VERSION | |
IMAGE_ID=${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_USERNAME }}/${{ secrets.IMAGE_NAME }} | |
docker tag $tmpName $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
docker tag $tmpName $IMAGE_ID:${VERSION}-$PHP_VERSION | |
docker push $IMAGE_ID:${VERSION}-$PHP_VERSION | |
if [ "$VERSION" == "fpm" ]; then docker tag $tmpName $IMAGE_ID:latest; fi | |
if [ "$VERSION" == "fpm" ]; then docker push $IMAGE_ID:latest; fi | |
done; |