Moving from the PHP official to Ubuntu and ondrej ppa (#1)

* Moving to Ubuntu + ppa/ondrej reduced from 705Mb to 534Mb

* Remove legacy build

* Fix the pipeline
master
Carlos Gomes 2022-08-23 19:57:20 +02:00 zatwierdzone przez GitHub
rodzic 66c72374b0
commit c8cd004633
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
6 zmienionych plików z 132 dodań i 182 usunięć

16
.editorconfig 100644
Wyświetl plik

@ -0,0 +1,16 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab

Wyświetl plik

@ -6,9 +6,14 @@ on:
- main - main
workflow_dispatch: workflow_dispatch:
env:
IMAGE: carlosalgms/composer-and-node-ci
jobs: jobs:
build_latest: build_latest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TAG: php8
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -25,38 +30,15 @@ jobs:
with: with:
pull: true pull: true
push: true push: true
cache-from: carlosalgms/composer-and-node-ci:php8 cache-from: ${{ env.IMAGE }}:${{ env.TAG }}
cache-to: type=inline cache-to: type=inline
tags: carlosalgms/composer-and-node-ci:latest,carlosalgms/composer-and-node-ci:php8 tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ env.TAG }}
build_7:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to Docker Hub
id: docker_login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build 7 and push
id: docker_build
uses: docker/build-push-action@v2
with:
pull: true
push: true
cache-from: carlosalgms/composer-and-node-ci:php7
cache-to: type=inline
build-args: |
FROM_IMAGE=php:7-cli
tags: carlosalgms/composer-and-node-ci:php7
build_71: build_71:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TAG: php7.1
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -73,12 +55,10 @@ jobs:
with: with:
pull: true pull: true
push: true push: true
cache-from: carlosalgms/composer-and-node-ci:php7.1 cache-from: ${{ env.IMAGE }}:${{ env.TAG }}
cache-to: type=inline cache-to: type=inline
build-args: | build-args: |
FROM_IMAGE=php:7.1-cli PHP_VERSION=7.1
DEPLOYER_VERSION=v6.6.0 DEPLOYER_VERSION=v6.6.0
PECL_EXT= COMPOSER_VERSION=2.2.18
ENABLE_EXT= tags: ${{ env.IMAGE }}:${{ env.TAG }}
PHP_EXT=mysqli pspell zip mcrypt
tags: carlosalgms/composer-and-node-ci:php7.1

Wyświetl plik

@ -1,88 +1,87 @@
ARG FROM_IMAGE=php:8-cli FROM ubuntu:jammy
FROM $FROM_IMAGE
LABEL maintainer="Carlos A. Gomes <carlos.algms@gmail.com>" LABEL maintainer="Carlos A. Gomes <carlos.algms@gmail.com>"
RUN \
RUN apt-get update \ apt update \
&& apt-get upgrade -y \ && apt upgrade -y \
&& apt-get install -y --no-install-recommends \ && apt install -y --no-install-recommends \
util-linux \ apt-transport-https \
zsh \ curl \
vim \ default-mysql-client \
ca-certificates \ dirmngr \
zip \ git \
unzip \ gpg \
openssh-client \ gpg-agent \
rsync \ make \
git \ openssh-client \
default-mysql-client \ rsync \
make \ software-properties-common \
&& apt-get autoremove -y --purge \ tini \
&& apt-get autoclean \ unzip \
&& apt-get clean \ vim \
&& rm -rf /var/cache/debconf/*-old \ xz-utils \
&& rm -rf /usr/share/doc/* \ zip \
&& rm -rf /var/lib/apt/lists/* \ zsh \
&& rm -rf /var/cache/apt/* && apt autoremove -y --purge \
&& apt autoclean -y \
&& apt clean -y \
&& rm -rf /var/cache/debconf/*-old \
&& rm -rf /usr/share/doc/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
ARG PECL_EXT="mcrypt-1.0.4" ARG PHP_VERSION=8.2
ARG PHP_EXT="mysqli pspell zip" RUN \
ARG ENABLE_EXT="mcrypt" LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
&& DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
RUN apt-get update \ php-pear \
&& apt-get install -y --no-install-recommends \ php${PHP_VERSION}-cli \
libzip4 \ php${PHP_VERSION}-common \
libmcrypt4 \ php${PHP_VERSION}-curl \
aspell \ php${PHP_VERSION}-mysql \
g++ \ php${PHP_VERSION}-sqlite3 \
autoconf \ php${PHP_VERSION}-xml \
libzip-dev \ php${PHP_VERSION}-zip \
libmcrypt-dev \ && apt autoremove -y --purge \
libaspell-dev \ && apt autoclean -y \
libpspell-dev \ && apt clean -y \
&& ( \ && rm -rf /var/cache/debconf/*-old \
[ -z "$PECL_EXT" ] || \ && rm -rf /usr/share/doc/* \
( \ && rm -rf /var/lib/apt/lists/* \
pecl install $PECL_EXT \ && rm -rf /var/cache/apt/*
&& docker-php-ext-enable $ENABLE_EXT \
) \
) \
&& docker-php-ext-install -j "$(nproc)" $PHP_EXT \
&& apt-get remove -y --purge \
g++ \
autoconf \
libzip-dev \
libmcrypt-dev \
libaspell-dev \
libpspell-dev \
&& apt-get autoremove -y --purge \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/cache/debconf/*-old \
&& rm -rf /usr/share/doc/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
RUN curl "https://getcomposer.org/installer" --output "composer-setup.php" \ # https://getcomposer.org/download/
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; } echo PHP_EOL;" \ ARG COMPOSER_VERSION="2.4.1"
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ RUN \
&& rm "composer-setup.php" curl -L "https://getcomposer.org/installer" --output "composer-setup.php" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php \
--install-dir=/usr/local/bin \
--filename=composer \
--version=${COMPOSER_VERSION} \
&& rm "composer-setup.php"
ARG DEPLOYER_VERSION="v6.8.0" ARG DEPLOYER_VERSION="v6.8.0"
RUN curl -L https://deployer.org/releases/${DEPLOYER_VERSION}/deployer.phar --output /usr/local/bin/dep \ RUN \
&& chmod +x /usr/local/bin/dep curl -L "https://deployer.org/releases/${DEPLOYER_VERSION}/deployer.phar" \
--output /usr/local/bin/dep \
&& chmod +x /usr/local/bin/dep
# Install node, npm and yarn # Install node, npm and yarn
ARG NODE_VERSION="v16.13.0" ARG NODE_VERSION="v16.17.0"
RUN curl -O https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.xz \ RUN \
&& tar xJf node-v*.xz -C /usr --strip-components=1 --no-same-owner \ curl -L "https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.xz" \
&& rm node-v*.xz \ --output node.tar.xz \
&& npm i -g yarn && tar xJf node.tar.xz -C /usr --strip-components=1 --no-same-owner \
&& rm node.tar.xz \
&& npm i -g yarn
COPY zshrc /root/.zshrc COPY zshrc /root/.zshrc
ENTRYPOINT ["/usr/bin/tini", "--"]

Wyświetl plik

@ -1,56 +0,0 @@
ARG FROM_IMAGE=php:8-cli-alpine
FROM $FROM_IMAGE
LABEL maintainer="Carlos A. Gomes <carlos.algms@gmail.com>"
RUN apk add --no-cache \
util-linux \
zsh \
vim \
ca-certificates \
zip \
unzip \
openssh \
rsync \
git \
mysql-client \
composer \
make
ARG PECL_EXT="mcrypt-1.0.4"
ARG PHP_EXT="mysqli pspell zip"
ARG ENABLE_EXT="mcrypt"
RUN apk add --no-cache \
libzip \
libmcrypt \
aspell; \
apk add --no-cache --virtual .build-deps \
g++ \
autoconf \
libzip-dev \
libmcrypt-dev \
aspell-dev; \
if [ ! -z "$PECL_EXT" ]; then \
pecl install $PECL_EXT \
&& docker-php-ext-enable $ENABLE_EXT; \
fi; \
docker-php-ext-install -j "$(nproc)" $PHP_EXT; \
apk del .build-deps
ARG DEPLOYER_VERSION="v6.8.0"
RUN curl -L https://deployer.org/releases/${DEPLOYER_VERSION}/deployer.phar --output /usr/local/bin/dep \
&& chmod +x /usr/local/bin/dep
# Install node, npm and yarn
ARG NODE_VERSION="v16.13.0"
RUN curl -O https://unofficial-builds.nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64-musl.tar.xz \
&& tar xJf node-v*.xz -C /usr --strip-components=1 --no-same-owner \
&& rm node-v*.xz \
&& npm i -g yarn
COPY zshrc /root/.zshrc

Wyświetl plik

@ -1,19 +1,18 @@
IMAGE=carlosalgms/composer-and-node-ci
TARGET=Dockerfile
build_8: build_8:
docker build . --rm \ docker pull $(IMAGE):php8 || true; \
-t carlosalgms/composer-and-node-ci:latest \ docker buildx build --rm . \
-t carlosalgms/composer-and-node-ci:php8 -f $(TARGET) \
-t $(IMAGE):latest \
-t $(IMAGE):php8
build_7:
docker build . --rm \
--build-arg=FROM_IMAGE="php:7-cli" \
-t carlosalgms/composer-and-node-ci:php7
build_71: build_71:
docker build . --rm \ docker buildx build --rm . \
--build-arg=FROM_IMAGE="php:7.1-cli" \ -f $(TARGET) \
--build-arg=PHP_VERSION="7.1" \
--build-arg=DEPLOYER_VERSION="v6.6.0" \ --build-arg=DEPLOYER_VERSION="v6.6.0" \
--build-arg=PECL_EXT="" \ --build-arg=COMPOSER_VERSION="2.2.18" \
--build-arg=ENABLE_EXT="" \ -t $(IMAGE):php7.1 \
--build-arg=PHP_EXT="mysqli pspell zip mcrypt" \
-t carlosalgms/composer-and-node-ci:php7.1 \

Wyświetl plik

@ -1,10 +1,10 @@
# composer-and-node-ci Docker image # Docker composer-and-node-ci image
A docker image to be used on continuous integration projects. A docker image to be used on continuous integration projects.
The idea is to include everything you need to run unit tests and build frontend projects. The idea is to include everything you need to run unit tests and build frontend projects.
Also, it is possible to run pure PHP or with frameworks like Laravel or CodeIgniter, Composer for dependency manager. Also, it is possible to run pure PHP scripts, Composer for dependency manager.
To deploy and transfer files, [Deployer](https://deployer.org), SSH, and RSync are available. To deploy and transfer files, [Deployer](https://deployer.org), SSH, and RSync are available.
@ -13,10 +13,10 @@ To deploy and transfer files, [Deployer](https://deployer.org), SSH, and RSync a
## This image includes: ## This image includes:
* [NodeJS 16.x and NPM](https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions) * [NodeJS 16.x and NPM](https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions)
* [yarn - latest](https://classic.yarnpkg.com/en/docs/install/#debian-stable) * [Yarn - latest](https://classic.yarnpkg.com/en/docs/install/#debian-stable)
* PHP 8-cli, 7.1-cli * PHP 8-cli, 7.1-cli
* [Composer - latest](https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md) * [Composer](https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md) (latest or v2.2.18 for php7.1)
* [Deployer](https://deployer.org) * [Deployer](https://deployer.org) (v6.8.0 or v6.6.0 for php7.1)
* OpenSSH client * OpenSSH client
* Git * Git
* RSync * RSync
@ -32,40 +32,52 @@ To deploy and transfer files, [Deployer](https://deployer.org), SSH, and RSync a
$ php -m $ php -m
[PHP Modules] [PHP Modules]
calendar
Core Core
ctype ctype
curl curl
date date
dom dom
exif
FFI
fileinfo fileinfo
filter filter
ftp ftp
gettext
hash hash
iconv iconv
json json
libxml libxml
mbstring
mcrypt
mysqli mysqli
mysqlnd mysqlnd
openssl openssl
pcntl
pcre pcre
PDO PDO
pdo_mysql
pdo_sqlite pdo_sqlite
Phar Phar
posix posix
pspell random
readline readline
Reflection Reflection
session session
shmop
SimpleXML SimpleXML
sockets
sodium
SPL SPL
sqlite3 sqlite3
standard standard
sysvmsg
sysvsem
sysvshm
tokenizer tokenizer
xml xml
xmlreader xmlreader
xmlwriter xmlwriter
xsl
Zend OPcache
zip zip
zlib zlib
``` ```