Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
Proxy
Merge requests
!28
Resolve "optimize pipeline"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "optimize pipeline"
29-optimize-pipeline
into
master
Overview
0
Commits
20
Pipelines
0
Changes
8
Merged
Dominik Hebeler
requested to merge
29-optimize-pipeline
into
master
3 years ago
Overview
0
Commits
20
Pipelines
0
Changes
1
Expand
Closes
#29 (closed)
Edited
3 years ago
by
Dominik Hebeler
0
0
Merge request reports
Compare
version 2
version 28
86e10731
3 years ago
version 27
52d49c1b
3 years ago
version 26
0e813052
3 years ago
version 25
ad34d10a
3 years ago
version 24
c5c40e48
3 years ago
version 23
17fbae5d
3 years ago
version 22
a51c92f2
3 years ago
version 21
df0f98ff
3 years ago
version 20
14f34e77
3 years ago
version 19
3adc65fa
3 years ago
version 18
97ad8d2c
3 years ago
version 17
0eefeea7
3 years ago
version 16
ec61e383
3 years ago
version 15
437ee338
3 years ago
version 14
ee9dd00e
3 years ago
version 13
20b4d962
3 years ago
version 12
4d9fba3e
3 years ago
version 11
62feab6c
3 years ago
version 10
399fb9de
3 years ago
version 9
34e2be50
3 years ago
version 8
4fbedfb0
3 years ago
version 7
97517088
3 years ago
version 6
d55aa34a
3 years ago
version 5
97d6f220
3 years ago
version 4
5237a1c0
3 years ago
version 3
d1bb7b66
3 years ago
version 2
a372b85a
3 years ago
version 1
3dc145cb
3 years ago
master (base)
and
version 3
latest version
2c85f03c
20 commits,
3 years ago
version 28
86e10731
19 commits,
3 years ago
version 27
52d49c1b
18 commits,
3 years ago
version 26
0e813052
17 commits,
3 years ago
version 25
ad34d10a
16 commits,
3 years ago
version 24
c5c40e48
15 commits,
3 years ago
version 23
17fbae5d
14 commits,
3 years ago
version 22
a51c92f2
13 commits,
3 years ago
version 21
df0f98ff
12 commits,
3 years ago
version 20
14f34e77
11 commits,
3 years ago
version 19
3adc65fa
10 commits,
3 years ago
version 18
97ad8d2c
9 commits,
3 years ago
version 17
0eefeea7
8 commits,
3 years ago
version 16
ec61e383
7 commits,
3 years ago
version 15
437ee338
6 commits,
3 years ago
version 14
ee9dd00e
5 commits,
3 years ago
version 13
20b4d962
4 commits,
3 years ago
version 12
4d9fba3e
3 commits,
3 years ago
version 11
62feab6c
12 commits,
3 years ago
version 10
399fb9de
11 commits,
3 years ago
version 9
34e2be50
10 commits,
3 years ago
version 8
4fbedfb0
9 commits,
3 years ago
version 7
97517088
8 commits,
3 years ago
version 6
d55aa34a
7 commits,
3 years ago
version 5
97d6f220
5 commits,
3 years ago
version 4
5237a1c0
4 commits,
3 years ago
version 3
d1bb7b66
3 commits,
3 years ago
version 2
a372b85a
2 commits,
3 years ago
version 1
3dc145cb
1 commit,
3 years ago
Show latest version
1 file
+
1
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Dockerfile
+
67
−
24
Options
FROM
debian:10
# syntax = docker/dockerfile:experimental
FROM
debian:10
AS
dependencies
WORKDIR
/html
EXPOSE
8080
# Install System Components
RUN
apt update
\
&&
apt
install
-y
\
nginx
\
tzdata
\
cron
\
lsb-release
\
apt-transport-https
\
zip
\
curl
curl
\
zip
RUN
curl
-o
/etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
\
&&
echo
"deb https://packages.sury.org/php/
$(
lsb_release
-sc
)
main"
|
tee
/etc/apt/sources.list.d/php.list
@@ -30,15 +33,34 @@ RUN apt update \
php7.4-dom
\
php7.4-fileinfo
\
php7.4-redis
\
php7.4-xdebug
\
php7.4-zip
WORKDIR
/html
# Install Composer
COPY
./helpers/installComposer.sh /usr/bin/installComposer
RUN
chmod
+x /usr/bin/installComposer
&&
\
/usr/bin/installComposer
&&
\
rm
/usr/bin/installComposer
RUN
sed
-i
's/error_log = \/var\/log\/php7.4-fpm.log/error_log = \/dev\/stderr/g'
/etc/php/7.4/fpm/php-fpm.conf
&&
\
# Install Nodejs
COPY
./helpers/installNodejs.sh /usr/bin/installNodejs
RUN
chmod
+x /usr/bin/installNodejs
&&
\
/usr/bin/installNodejs
&&
\
rm
/usr/bin/installNodejs
ENV
PATH /usr/local/lib/nodejs/bin:$PATH
# Install Minio Client
RUN
curl
-o
/usr/bin/mc
"https://dl.min.io/client/mc/release/linux-amd64/mc"
&&
\
chmod
+x /usr/bin/mc
FROM
dependencies
AS
development
RUN
sed
-i
's/pid = \/run\/php\/php7.4-fpm.pid/;pid = \/run\/php\/php7.4-fpm.pid/g'
/etc/php/7.4/fpm/php-fpm.conf
&&
\
sed
-i
's/error_log = \/var\/log\/php7.4-fpm.log/error_log = \/dev\/stderr/g'
/etc/php/7.4/fpm/php-fpm.conf
&&
\
sed
-i
's/;daemonize = yes/daemonize = no/g'
/etc/php/7.4/fpm/php-fpm.conf
&&
\
mkdir
-p
/run/php
&&
\
sed
-i
's/listen = \/run\/php\/php7.4-fpm.sock/listen = 9000/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/decorate_workers_output = no/decorate_workers_output = no/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/;catch_workers_output = yes/catch_workers_output = yes/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/user = nobody/user = www-data/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/group = nobody/group = www-data/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/pm.max_children = 5/pm.max_children = 1024/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
@@ -46,33 +68,54 @@ RUN sed -i 's/error_log = \/var\/log\/php7.4-fpm.log/error_log = \/dev\/stderr/g
sed
-i
's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/pm.max_spare_servers = 3/pm.max_spare_servers = 50/g'
/etc/php/7.4/fpm/pool.d/www.conf
&&
\
sed
-i
's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/expose_php = On/expose_php = Off/g'
/etc/php/7.4/fpm/php.ini
&&
\
# Opcache configuration
sed
-i
's/;zend_extension=xdebug.so/zend_extension=xdebug.so/g'
/etc/php/7.4/fpm/conf.d/20-xdebug.ini
&&
\
echo
"xdebug.mode = debug"
>>
/etc/php/7.4/fpm/conf.d/20-xdebug.ini
&&
\
echo
"xdebug.start_with_request = yes"
>>
/etc/php/7.4/fpm/conf.d/20-xdebug.ini
&&
\
echo
"xdebug.discover_client_host = true"
>>
/etc/php/7.4/fpm/conf.d/20-xdebug.ini
&&
\
echo
"xdebug.idekey=VSCODE"
>>
/etc/php/7.4/fpm/conf.d/20-xdebug.ini
&&
\
cp
/usr/share/zoneinfo/Europe/Berlin /etc/localtime
&&
\
echo
"Europe/Berlin"
>
/etc/timezone
# Using image as non-root
RUN
groupadd
-g
1000 metager-proxy
&&
\
useradd
-b
/home/metager-proxy
-g
1000
-u
1000
-M
-s
/bin/bash metager-proxy
RUN
chown
-R
1000:1000 /var/lib/nginx /var/log/nginx
RUN
mkdir
-p
/home/metager-proxy
&&
\
chown
1000:1000 /home/metager-proxy
RUN
touch
/run/nginx.pid
&&
\
chown
1000:1000 /run/nginx.pid
USER
1000:1000
CMD
/entrypoint.sh
# Just the changes we need for production use (i.e. enable opcache, disable xdebug, etc.)
FROM
development
AS
production
USER
0:0
# Opcache configuration
RUN
apt purge
-y
php7.4-xdebug
RUN
sed
-i
's/expose_php = On/expose_php = Off/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/;opcache.enable=1/opcache.enable=1/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/;opcache.memory_consumption=128/opcache.memory_consumption=128/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=10000/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed
-i
's/;opcache.validate_timestamps=1/opcache.validate_timestamps=1/g'
/etc/php/7.4/fpm/php.ini
&&
\
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=300/g' /etc/php/7.4/fpm/php.ini && \
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
echo "Europe/Berlin" > /etc/timezone && \
(crontab -l ; echo "* * * * * php /html/artisan schedule:run >> /dev/null 2>&1") | crontab -
sed
-i
's/;opcache.revalidate_freq=2/opcache.revalidate_freq=300/g'
/etc/php/7.4/fpm/php.ini
COPY
config/nginx.conf /etc/nginx/nginx.conf
COPY
config/nginx-default.conf /etc/nginx/sites-available/default
RUN
sed
-i
's/fastcgi_pass phpfpm:9000;/fastcgi_pass localhost:9000;/g'
/etc/nginx/sites-available/default
COPY
--chown=root:www-data . /html
COPY
./helpers/installComposer.sh /usr/bin/installComposer
RUN
chmod
+x /usr/bin/installComposer
&&
\
/usr/bin/installComposer
&&
\
rm
/usr/bin/installComposer
&&
\
composer
install
--no-dev
# Install Entrypoint
COPY
./helpers/entrypoint.sh /entrypoint.sh
RUN
chmod
+x /entrypoint.sh
WORKDIR
/html
EXPOSE
80
COPY
--chown=1000:1000 . /html
# Install packages
RUN
--mount
=
type
=
secret,id
=
auto-devops-build-secrets
.
/run/secrets/auto-devops-build-secrets
&&
\
chmod
+x ./helpers/installPackages.sh
&&
\
/bin/sh
-c
./helpers/installPackages.sh
CMD
cron -L /dev/stdout && \
php-fpm7.4 -F -R
USER
1000:1000
Loading