Skip to content

Commit

Permalink
php8 and php81 docker build (#7)
Browse files Browse the repository at this point in the history
* php8 and php81 docker build

* add github action to build image

* fix

* push only when master
  • Loading branch information
norbybaru authored Oct 26, 2022
1 parent 86514b7 commit 10adfd8
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 18 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Docker Image CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
base-image: [fpm-alpine, cli-alpine]
php: [7.4, '8.0', 8.1]
include:
- base-image: fpm-alpine
prefix: fpm
- base-image: cli-alpine
prefix: cli

name: PHP:${{ matrix.php }} - IMAGE:${{ matrix.base-image }} - PREFIX:${{ matrix.prefix }}

steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
env:
REPO_NAME: norby/php-alpine
BASE_IMAGE: ${{ matrix.base-image }}
VERSION: ${{ matrix.php }}
EXTRA_TAGS: "${{ matrix.php }}-${{ matrix.prefix }}"
run: ./hooks/build.sh

- name: Docker Push
if: github.ref == 'refs/heads/master'
run: ./hooks/push.sh
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ env:
- BASE_IMAGE=cli-alpine VERSION=7.2 EXTRA_TAGS="7.2-cli"
- BASE_IMAGE=fpm-alpine VERSION=7.3 EXTRA_TAGS="7.3-fpm"
- BASE_IMAGE=cli-alpine VERSION=7.3 EXTRA_TAGS="7.3-cli"
- BASE_IMAGE=fpm-alpine VERSION=7.4 EXTRA_TAGS="latest-fpm;7.4-fpm"
- BASE_IMAGE=cli-alpine VERSION=7.4 EXTRA_TAGS="latest-cli;7.4-cli"
- BASE_IMAGE=fpm-alpine VERSION=7.4 EXTRA_TAGS="7.4-fpm"
- BASE_IMAGE=cli-alpine VERSION=7.4 EXTRA_TAGS="7.4-cli"
- BASE_IMAGE=fpm-alpine VERSION=8.0 EXTRA_TAGS="8.0-fpm"
- BASE_IMAGE=cli-alpine VERSION=8.0 EXTRA_TAGS="8.0-cli"
- BASE_IMAGE=fpm-alpine VERSION=8.1 EXTRA_TAGS="latest-fpm;8.1-fpm"
- BASE_IMAGE=cli-alpine VERSION=8.1 EXTRA_TAGS="latest-cli;8.1-cli"

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
Expand Down
14 changes: 0 additions & 14 deletions hooks/push

This file was deleted.

8 changes: 8 additions & 0 deletions hooks/push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -ex

for tag in $(docker images norby/php-alpine --format "{{.Tag}}");
do
docker push "norby/php-alpine:${tag}"
done
8 changes: 6 additions & 2 deletions hooks/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ REPO_NAME=norby/php-alpine BASE_IMAGE=fpm-alpine VERSION=7.2 EXTRA_TAGS="7.2-fpm
REPO_NAME=norby/php-alpine BASE_IMAGE=cli-alpine VERSION=7.2 EXTRA_TAGS="7.2-cli"
REPO_NAME=norby/php-alpine BASE_IMAGE=fpm-alpine VERSION=7.3 EXTRA_TAGS="7.3-fpm"
REPO_NAME=norby/php-alpine BASE_IMAGE=cli-alpine VERSION=7.3 EXTRA_TAGS="7.3-cli"
REPO_NAME=norby/php-alpine BASE_IMAGE=fpm-alpine VERSION=7.4 EXTRA_TAGS="latest-fpm;7.4-fpm"
REPO_NAME=norby/php-alpine BASE_IMAGE=cli-alpine VERSION=7.4 EXTRA_TAGS="latest-cli;7.4-cli"
REPO_NAME=norby/php-alpine BASE_IMAGE=fpm-alpine VERSION=7.4 EXTRA_TAGS="7.4-fpm"
REPO_NAME=norby/php-alpine BASE_IMAGE=cli-alpine VERSION=7.4 EXTRA_TAGS="7.4-cli"
REPO_NAME=norby/php-alpine BASE_IMAGE=fpm-alpine VERSION=8.0 EXTRA_TAGS="8.0-fpm"
REPO_NAME=norby/php-alpine BASE_IMAGE=cli-alpine VERSION=8.0 EXTRA_TAGS="8.0-cli"
REPO_NAME=norby/php-alpine BASE_IMAGE=fpm-alpine VERSION=8.1 EXTRA_TAGS="latest-fpm;8.1-fpm"
REPO_NAME=norby/php-alpine BASE_IMAGE=cli-alpine VERSION=8.1 EXTRA_TAGS="latest-cli;8.1-cli"
'
59 changes: 59 additions & 0 deletions tags/8.0/extentions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

set -eux \
&& apk update \
&& apk upgrade \
&& apk add --no-cache --virtual .build_deps \
$PHPIZE_DEPS \
curl-dev \
freetype-dev \
imagemagick-dev \
libtool \
libxml2-dev \
libpng-dev \
libwebp-dev \
libjpeg-turbo-dev \
make \
oniguruma-dev \
gcc > /dev/null \
&& apk add --no-cache \
zlib-dev \
libzip-dev \
libgomp \
curl \
imagemagick \
mysql-client \
libintl \
libpng \
libjpeg-turbo \
icu-dev \
icu \
freetype \
vim \
unzip \
composer \
nodejs \
bash > /dev/null \
&& docker-php-ext-configure \
gd --with-freetype=/usr/include/freetype2/ --with-jpeg=/usr/include/ --with-webp=/usr/include/webp > /dev/null \
&& docker-php-ext-install \
mbstring \
pdo \
pdo_mysql \
mysqli \
pcntl \
tokenizer \
xml \
zip \
intl \
ctype \
bcmath \
-j$(nproc) gd > /dev/null \
&& pecl install \
-o -f imagick > /dev/null \
&& docker-php-ext-enable \
gd \
imagick \
mysqli > /dev/null \
&& apk del --no-cache -f .build_deps \
&& rm -f /var/cache/apk/*
58 changes: 58 additions & 0 deletions tags/8.1/extentions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -eux \
&& apk update \
&& apk upgrade \
&& apk add --no-cache --virtual .build_deps \
$PHPIZE_DEPS \
curl-dev \
freetype-dev \
imagemagick-dev \
libtool \
libxml2-dev \
libpng-dev \
libwebp-dev \
libjpeg-turbo-dev \
make \
oniguruma-dev \
gcc > /dev/null \
&& apk add --no-cache \
zlib-dev \
libzip-dev \
libgomp \
curl \
imagemagick \
mysql-client \
libintl \
libpng \
libjpeg-turbo \
icu-dev \
icu \
freetype \
vim \
unzip \
composer \
nodejs \
bash > /dev/null \
&& docker-php-ext-configure \
gd --with-freetype=/usr/include/freetype2/ --with-jpeg=/usr/include/ --with-webp=/usr/include/webp > /dev/null \
&& docker-php-ext-install \
mbstring \
pdo \
pdo_mysql \
mysqli \
pcntl \
xml \
zip \
intl \
ctype \
bcmath \
-j$(nproc) gd > /dev/null \
&& pecl install \
-o -f imagick > /dev/null \
&& docker-php-ext-enable \
gd \
imagick \
mysqli > /dev/null \
&& apk del --no-cache -f .build_deps \
&& rm -f /var/cache/apk/*

0 comments on commit 10adfd8

Please sign in to comment.