sforkowany z mirror/composer-and-node-ci
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 pipelinemaster
rodzic
66c72374b0
commit
c8cd004633
|
@ -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
|
|
@ -6,9 +6,14 @@ on:
|
|||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
IMAGE: carlosalgms/composer-and-node-ci
|
||||
|
||||
jobs:
|
||||
build_latest:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TAG: php8
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
@ -25,38 +30,15 @@ jobs:
|
|||
with:
|
||||
pull: true
|
||||
push: true
|
||||
cache-from: carlosalgms/composer-and-node-ci:php8
|
||||
cache-from: ${{ env.IMAGE }}:${{ env.TAG }}
|
||||
cache-to: type=inline
|
||||
tags: carlosalgms/composer-and-node-ci:latest,carlosalgms/composer-and-node-ci:php8
|
||||
|
||||
|
||||
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
|
||||
tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ env.TAG }}
|
||||
|
||||
|
||||
build_71:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TAG: php7.1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
@ -73,12 +55,10 @@ jobs:
|
|||
with:
|
||||
pull: true
|
||||
push: true
|
||||
cache-from: carlosalgms/composer-and-node-ci:php7.1
|
||||
cache-from: ${{ env.IMAGE }}:${{ env.TAG }}
|
||||
cache-to: type=inline
|
||||
build-args: |
|
||||
FROM_IMAGE=php:7.1-cli
|
||||
PHP_VERSION=7.1
|
||||
DEPLOYER_VERSION=v6.6.0
|
||||
PECL_EXT=
|
||||
ENABLE_EXT=
|
||||
PHP_EXT=mysqli pspell zip mcrypt
|
||||
tags: carlosalgms/composer-and-node-ci:php7.1
|
||||
COMPOSER_VERSION=2.2.18
|
||||
tags: ${{ env.IMAGE }}:${{ env.TAG }}
|
||||
|
|
143
Dockerfile
143
Dockerfile
|
@ -1,88 +1,87 @@
|
|||
ARG FROM_IMAGE=php:8-cli
|
||||
FROM $FROM_IMAGE
|
||||
FROM ubuntu:jammy
|
||||
|
||||
LABEL maintainer="Carlos A. Gomes <carlos.algms@gmail.com>"
|
||||
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
util-linux \
|
||||
zsh \
|
||||
vim \
|
||||
ca-certificates \
|
||||
zip \
|
||||
unzip \
|
||||
openssh-client \
|
||||
rsync \
|
||||
git \
|
||||
default-mysql-client \
|
||||
make \
|
||||
&& apt-get autoremove -y --purge \
|
||||
&& apt-get autoclean \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/cache/debconf/*-old \
|
||||
&& rm -rf /usr/share/doc/* \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /var/cache/apt/*
|
||||
RUN \
|
||||
apt update \
|
||||
&& apt upgrade -y \
|
||||
&& apt install -y --no-install-recommends \
|
||||
apt-transport-https \
|
||||
curl \
|
||||
default-mysql-client \
|
||||
dirmngr \
|
||||
git \
|
||||
gpg \
|
||||
gpg-agent \
|
||||
make \
|
||||
openssh-client \
|
||||
rsync \
|
||||
software-properties-common \
|
||||
tini \
|
||||
unzip \
|
||||
vim \
|
||||
xz-utils \
|
||||
zip \
|
||||
zsh \
|
||||
&& 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_EXT="mysqli pspell zip"
|
||||
ARG ENABLE_EXT="mcrypt"
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libzip4 \
|
||||
libmcrypt4 \
|
||||
aspell \
|
||||
g++ \
|
||||
autoconf \
|
||||
libzip-dev \
|
||||
libmcrypt-dev \
|
||||
libaspell-dev \
|
||||
libpspell-dev \
|
||||
&& ( \
|
||||
[ -z "$PECL_EXT" ] || \
|
||||
( \
|
||||
pecl install $PECL_EXT \
|
||||
&& 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/*
|
||||
ARG PHP_VERSION=8.2
|
||||
RUN \
|
||||
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||
php-pear \
|
||||
php${PHP_VERSION}-cli \
|
||||
php${PHP_VERSION}-common \
|
||||
php${PHP_VERSION}-curl \
|
||||
php${PHP_VERSION}-mysql \
|
||||
php${PHP_VERSION}-sqlite3 \
|
||||
php${PHP_VERSION}-xml \
|
||||
php${PHP_VERSION}-zip \
|
||||
&& 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/*
|
||||
|
||||
|
||||
RUN curl "https://getcomposer.org/installer" --output "composer-setup.php" \
|
||||
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; } echo PHP_EOL;" \
|
||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
|
||||
&& rm "composer-setup.php"
|
||||
# https://getcomposer.org/download/
|
||||
ARG COMPOSER_VERSION="2.4.1"
|
||||
RUN \
|
||||
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"
|
||||
RUN curl -L https://deployer.org/releases/${DEPLOYER_VERSION}/deployer.phar --output /usr/local/bin/dep \
|
||||
&& chmod +x /usr/local/bin/dep
|
||||
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://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.xz \
|
||||
&& tar xJf node-v*.xz -C /usr --strip-components=1 --no-same-owner \
|
||||
&& rm node-v*.xz \
|
||||
&& npm i -g yarn
|
||||
ARG NODE_VERSION="v16.17.0"
|
||||
RUN \
|
||||
curl -L "https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.xz" \
|
||||
--output node.tar.xz \
|
||||
&& 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
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||
|
|
|
@ -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
|
25
Makefile
25
Makefile
|
@ -1,19 +1,18 @@
|
|||
IMAGE=carlosalgms/composer-and-node-ci
|
||||
TARGET=Dockerfile
|
||||
|
||||
build_8:
|
||||
docker build . --rm \
|
||||
-t carlosalgms/composer-and-node-ci:latest \
|
||||
-t carlosalgms/composer-and-node-ci:php8
|
||||
docker pull $(IMAGE):php8 || true; \
|
||||
docker buildx build --rm . \
|
||||
-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:
|
||||
docker build . --rm \
|
||||
--build-arg=FROM_IMAGE="php:7.1-cli" \
|
||||
docker buildx build --rm . \
|
||||
-f $(TARGET) \
|
||||
--build-arg=PHP_VERSION="7.1" \
|
||||
--build-arg=DEPLOYER_VERSION="v6.6.0" \
|
||||
--build-arg=PECL_EXT="" \
|
||||
--build-arg=ENABLE_EXT="" \
|
||||
--build-arg=PHP_EXT="mysqli pspell zip mcrypt" \
|
||||
-t carlosalgms/composer-and-node-ci:php7.1 \
|
||||
--build-arg=COMPOSER_VERSION="2.2.18" \
|
||||
-t $(IMAGE):php7.1 \
|
||||
|
|
28
README.md
28
README.md
|
@ -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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -13,10 +13,10 @@ To deploy and transfer files, [Deployer](https://deployer.org), SSH, and RSync a
|
|||
## This image includes:
|
||||
|
||||
* [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
|
||||
* [Composer - latest](https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md)
|
||||
* [Deployer](https://deployer.org)
|
||||
* [Composer](https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md) (latest or v2.2.18 for php7.1)
|
||||
* [Deployer](https://deployer.org) (v6.8.0 or v6.6.0 for php7.1)
|
||||
* OpenSSH client
|
||||
* Git
|
||||
* RSync
|
||||
|
@ -32,40 +32,52 @@ To deploy and transfer files, [Deployer](https://deployer.org), SSH, and RSync a
|
|||
$ php -m
|
||||
|
||||
[PHP Modules]
|
||||
calendar
|
||||
Core
|
||||
ctype
|
||||
curl
|
||||
date
|
||||
dom
|
||||
exif
|
||||
FFI
|
||||
fileinfo
|
||||
filter
|
||||
ftp
|
||||
gettext
|
||||
hash
|
||||
iconv
|
||||
json
|
||||
libxml
|
||||
mbstring
|
||||
mcrypt
|
||||
mysqli
|
||||
mysqlnd
|
||||
openssl
|
||||
pcntl
|
||||
pcre
|
||||
PDO
|
||||
pdo_mysql
|
||||
pdo_sqlite
|
||||
Phar
|
||||
posix
|
||||
pspell
|
||||
random
|
||||
readline
|
||||
Reflection
|
||||
session
|
||||
shmop
|
||||
SimpleXML
|
||||
sockets
|
||||
sodium
|
||||
SPL
|
||||
sqlite3
|
||||
standard
|
||||
sysvmsg
|
||||
sysvsem
|
||||
sysvshm
|
||||
tokenizer
|
||||
xml
|
||||
xmlreader
|
||||
xmlwriter
|
||||
xsl
|
||||
Zend OPcache
|
||||
zip
|
||||
zlib
|
||||
```
|
||||
|
|
Ładowanie…
Reference in New Issue