-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
108 lines (92 loc) · 4.79 KB
/
Dockerfile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# syntax=docker/dockerfile:1.4.2-labs
# PHP version
# examples of allowed values: 5.6-cli, 5.6-cli-alpine, 7.4-cli, 7.4-cli-alpine
# and other tags from https://hub.docker.com/_/php
ARG PHP_VERSION=5.6-cli
########################################################################################################################
FROM php:${PHP_VERSION} AS default
WORKDIR /usr/src/yii2-domain-validator
# install PHP extensions
RUN curl --silent --show-error --location --output /usr/local/bin/install-php-extensions \
https://github.com/mlocati/docker-php-extension-installer/releases/download/1.5.20/install-php-extensions \
&& chmod a+x /usr/local/bin/install-php-extensions \
&& sync \
&& install-php-extensions \
intl `# for app` \
pcntl `# for tests` \
xdebug `# for tests`
# install the latest stable Composer 1.x version
RUN curl --silent --show-error --location https://getcomposer.org/installer | php -- --1 \
&& mv composer.phar /usr/local/bin/composer
COPY composer.json ./
########################################################################################################################
FROM default AS alpine
# install system packages
RUN apk update \
&& apk add \
git `# for Composer and developers` \
nano `# for developers` \
unzip `# for Composer`
# install dependencies using Composer
RUN --mount=type=cache,id=composer,target=/root/.composer/cache,sharing=locked \
composer global require --optimize-autoloader 'fxp/composer-asset-plugin:^1.4.6' \
\
# workarounds for Composer plugin fxp/composer-asset-plugin:
# 1) plugin may ask Git to clone repository using "git+ssh" protocol,
# for example git+ssh://[email protected]/garycourt/uri-js.git,
# but it requires SSH key linked with GitHub account which we have not in Docker;
&& git config --global --add url.'https://'.insteadOf 'git+ssh://git@' \
# 2) plugin may ask Git to clone repository using "git+https" protocol,
# for example git+https://github.com/vibornoff/asmcrypto.js,
# but it is not supported by Git which we have in Docker;
&& git config --global --add url.'https://'.insteadOf 'git+https://' \
# 3) plugin may ask Git to clone repository using "git" protocol,
# but the unencrypted "git" protocol is permanently disabled on GitHub,
# see https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys.
&& git config --global --add url.'https://github.com/'.insteadOf '[email protected]:' \
&& composer update \
&& composer clear-cache
########################################################################################################################
FROM default AS debian
# install system packages
RUN apt-get update \
&& apt-get --assume-yes --no-install-recommends install \
gnupg2 \
&& apt-key update \
&& apt-get update \
&& apt-get --assume-yes --no-install-recommends install \
git `# for Composer and developers` \
nano `# for developers` \
unzip `# for Composer` \
\
# clean up
&& rm --force --recursive /var/lib/apt/lists/* /tmp/* /var/tmp/*
# install dependencies using Composer
RUN --mount=type=cache,id=composer,target=/root/.composer/cache,sharing=locked \
composer global require --optimize-autoloader 'fxp/composer-asset-plugin:^1.4.6' \
\
# workarounds for Composer plugin fxp/composer-asset-plugin:
# 1) plugin may ask Git to clone repository using "git+ssh" protocol,
# for example git+ssh://[email protected]/garycourt/uri-js.git,
# but it requires SSH key linked with GitHub account which we have not in Docker;
&& git config --global --add url.'https://'.insteadOf 'git+ssh://git@' \
# 2) plugin may ask Git to clone repository using "git+https" protocol,
# for example git+https://github.com/vibornoff/asmcrypto.js,
# but it is not supported by Git which we have in Docker;
&& git config --global --add url.'https://'.insteadOf 'git+https://' \
# 3) plugin may ask Git to clone repository using "git" protocol,
# but the unencrypted "git" protocol is permanently disabled on GitHub,
# see https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys.
&& git config --global --add url.'https://github.com/'.insteadOf '[email protected]:' \
&& composer update \
&& composer clear-cache
########################################################################################################################
FROM debian AS debian-runkit
# install runkit extension
RUN pecl install \
runkit `# for tests`
########################################################################################################################
FROM debian AS debian-runkit7
# install runkit7 extension
RUN pecl install \
runkit7-4.0.0a3 `# for tests`