Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yann Guenneugues
pastell
Commits
f7463ad2
Commit
f7463ad2
authored
May 08, 2021
by
Eric Pommateau
Browse files
Dockerfile enhacement
parent
53fffa66
Changes
9
Hide whitespace changes
Inline
Side-by-side
.dockerignore
View file @
f7463ad2
...
...
@@ -3,4 +3,5 @@ Dockerfile
docker-compose.override.yml
docker-compose.yml
.gitlab-ci.yml
.git
\ No newline at end of file
.git
vendor
.gitlab-ci.yml
View file @
f7463ad2
...
...
@@ -30,7 +30,7 @@ build:
-
sed -i "s/%BUILD_DATE%/$date/" ./manifest.yml
-
sed -i "s/%VERSION%/${CI_COMMIT_REF_NAME}/" ./manifest.yml
-
docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
-
docker build --build-arg GITHUB_API_TOKEN=$GITHUB_API_TOKEN --pull -t ${CONTAINER_IMAGE} .
-
docker build --build-arg GITHUB_API_TOKEN=$GITHUB_API_TOKEN
--target pastell_dev
--pull -t ${CONTAINER_IMAGE} .
-
docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
-
docker push ${CONTAINER_IMAGE}
...
...
@@ -52,7 +52,6 @@ unit_test:
stage
:
test
image
:
"
$CONTAINER_IMAGE"
variables
:
PCOV_ON
:
1
GIT_STRATEGY
:
none
COMPOSER_PROCESS_TIMEOUT
:
1200
DONT_RETRIEVE_VALIDCA
:
"
true"
...
...
Dockerfile
View file @
f7463ad2
...
...
@@ -7,7 +7,7 @@ FROM ubuntu:18.04 as pcov_ext
RUN
apt-get update
&&
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
php-dev
RUN
pecl
install
pcov
FROM
ubuntu:18.04
FROM
ubuntu:18.04
as
pastell_base
ARG
GITHUB_API_TOKEN
EXPOSE
443 80
...
...
@@ -15,26 +15,24 @@ VOLUME /data/workspace
WORKDIR
/var/www/pastell/
ENV
PATH="${PATH}:/var/www/pastell/vendor/bin/"
COPY
--from=pcov_ext /usr/lib/php/20170718/pcov.so /usr/lib/php/20170718/pcov.so
# Install requirements
COPY
./ci-resources/install-requirements.sh /
root
/
RUN
/bin/bash /
root
/install-requirements.sh
COPY
./ci-resources/install-requirements.sh /
var/www/pastell/ci-resources
/
RUN
/bin/bash /
var/www/pastell/ci-resources
/install-requirements.sh
COPY
--from=composer:2.0 /usr/bin/composer /usr/bin/composer
# Create Pastell needs
COPY
./ci-resources
/ /tmp
/ci-resources
/
RUN
/bin/bash /
tmp
/ci-resources/docker-construction.sh
COPY
./ci-resources
/var/www/pastell
/ci-resources
RUN
/bin/bash /
var/www/pastell
/ci-resources/docker-construction.sh
COPY
--chown=www-data:www-data --from=node_modules /var/www/pastell/node_modules /var/www/pastell/node_modules
# Composer stuff
COPY
./composer.* /var/www/pastell/
RUN
/bin/bash /
tmp
/ci-resources/github/create-auth-file.sh
&&
\
RUN
/bin/bash /
var/www/pastell
/ci-resources/github/create-auth-file.sh
&&
\
/bin/bash
-c
'mkdir -p /var/www/pastell/{web,web-mailsec}'
&&
\
composer
install
&&
\
composer
install
--no-dev
&&
\
rm
-rf
/root/.composer/
# Pastell sources
...
...
@@ -42,3 +40,11 @@ COPY --chown=www-data:www-data ./ /var/www/pastell/
ENTRYPOINT
["docker-pastell-entrypoint"]
CMD
["/usr/bin/supervisord"]
FROM
pastell_base
as
pastell_dev
COPY
--from=pcov_ext /usr/lib/php/20170718/pcov.so /usr/lib/php/20170718/pcov.so
RUN
/bin/bash /var/www/pastell/ci-resources/install-dev-requirements.sh
FROM
pastell_base
as
pastell_prod
\ No newline at end of file
README.md
View file @
f7463ad2
...
...
@@ -31,8 +31,6 @@ Lors du démarrage, le Docker :
| MYSQL_DATABASE | Nom de la base de données | pastell |
| REDIS_SERVER | Hote du serveur Redis | (vide) |
| REDIS_PORT | Port du serveur Redis | 6379 |
| XDEBUG_ON | Indique si on doit activer XDEBUG (développement/test seulement) | (vide) |
| PCOV_ON | Indique si on doit activer PCOV (Uniquement pour la couverture de code) | (vide) |
| PASTELL_ADMIN_LOGIN | Login de l'administrateur | admin |
| PASTELL_ADMIN_PASSWORD | Mot de passe de l'administrateur | admin |
| PASTELL_ADMIN_EMAIL | Email de l'administrateur | noreply@libriciel.coop |
...
...
@@ -92,7 +90,6 @@ docker-compose up -d
PHPStorm n'utilise pas docker-compose et écrase l'entrypoint lors du lancement de PHPUnit,
il convient donc de spécifier les variables d'environnements directement dans la confiuguration du lanceur PHPUnit.
XDEBUG_ON ne peut pas être mis à (empty) dans ce cas-là.
## Utilisation via gitlab-ci
...
...
ci-resources/docker-construction.sh
View file @
f7463ad2
...
...
@@ -10,17 +10,17 @@ chown www-data: -R /data/
mkdir
-p
/etc/apache2/ssl/
# Configuration of different system part
cp
/
tmp
/ci-resources/supervisord/
*
.conf /etc/supervisor/conf.d/
cp
/
tmp
/ci-resources/logrotate.d/
*
.conf /etc/logrotate.d/
cp
/
tmp
/ci-resources/cron.d/
*
/etc/cron.d/
cp
/
var/www/pastell
/ci-resources/supervisord/
*
.conf /etc/supervisor/conf.d/
cp
/
var/www/pastell
/ci-resources/logrotate.d/
*
.conf /etc/logrotate.d/
cp
/
var/www/pastell
/ci-resources/cron.d/
*
/etc/cron.d/
# Set PHP configuration
mkdir
-p
/var/lib/php/session/
chown
www-data: /var/lib/php/session
# TODO utiliser le phpenmod
cp
/
tmp
/ci-resources/php/
*
/etc/php/7.2/cli/conf.d/
cp
/
tmp
/ci-resources/php/
*
/etc/php/7.2/apache2/conf.d/
cp
/
var/www/pastell
/ci-resources/php/
*
/etc/php/7.2/cli/conf.d/
cp
/
var/www/pastell
/ci-resources/php/
*
/etc/php/7.2/apache2/conf.d/
# needed for the composer install
...
...
@@ -28,9 +28,9 @@ mkdir -p /var/www/pastell/vendor/
chown
www-data: /var/www/pastell/vendor/
# Apache configuration
cp
/
tmp
/ci-resources/pastell-apache-config.conf /etc/apache2/sites-available/pastell-apache-config.conf
cp
/
var/www/pastell
/ci-resources/pastell-apache-config.conf /etc/apache2/sites-available/pastell-apache-config.conf
a2ensite pastell-apache-config.conf
# Create entrypoint command
cp
/
tmp
/ci-resources/docker-pastell-entrypoint /usr/local/bin/
cp
/
var/www/pastell
/ci-resources/docker-pastell-entrypoint /usr/local/bin/
chmod
a+x /usr/local/bin/docker-pastell-entrypoint
ci-resources/docker-pastell-entrypoint
View file @
f7463ad2
#! /bin/bash
set
-e
if
[
-z
${
XDEBUG_ON
}
]
then
phpdismod xdebug
else
phpenmod xdebug
fi
if
[
-z
${
PCOV_ON
}
]
then
phpdismod pcov
else
phpenmod pcov
fi
/bin/bash /var/www/pastell/ci-resources/docker-pastell-init
>
/data/config/DockerSettings.php
#A mettre dans le dockerfile ?
...
...
ci-resources/install-dev-requirements.sh
0 → 100644
View file @
f7463ad2
#!/usr/bin/env bash
set
-e
-x
export
DEBIAN_FRONTEND
=
noninteractive
apt-get update
apt-get
install
-y
--no-install-recommends
\
php-xdebug
rm
-r
/var/lib/apt/lists/
*
echo
"extension=pcov.so"
>
/etc/php/7.2/mods-available/pcov.ini
phpenmod xdebug pcov
/bin/bash /var/www/pastell/ci-resources/github/create-auth-file.sh
composer
install
rm
-rf
/root/.composer/
\ No newline at end of file
ci-resources/install-requirements.sh
View file @
f7463ad2
...
...
@@ -26,7 +26,6 @@ apt-get install -y --no-install-recommends \
php-redis
\
php-ssh2
\
php-soap
\
php-xdebug
\
php-xml
\
php-zip
\
supervisor
\
...
...
@@ -46,9 +45,6 @@ echo 'LANG="fr_FR.UTF-8"'>/etc/default/locale
dpkg-reconfigure
--frontend
=
noninteractive locales
update-locale
LANG
=
fr_FR.UTF-8
echo
"extension=pcov.so"
>
/etc/php/7.2/mods-available/pcov.ini
phpenmod pcov
rm
/etc/localtime
&&
ln
-s
/usr/share/zoneinfo/Europe/Paris /etc/localtime
# Libersign v1 stuff TODO
...
...
docker-compose.override.yml.dist
View file @
f7463ad2
...
...
@@ -16,6 +16,7 @@ services:
phpunit:
build:
context: .
target: pastell_dev
args:
GITHUB_API_TOKEN: ${GITHUB_API_TOKEN:-}
...
...
@@ -28,8 +29,6 @@ services:
MYSQL_HOST: ${MYSQL_HOST_TEST}
MYSQL_HOST_TEST: ${MYSQL_HOST_TEST}
REDIS_HOST: redis
XDEBUG_ON: 1
PCOV_ON: 1
PLATEFORME_MAIL: ${PLATEFORME_MAIL}
volumes:
- .:/var/www/pastell
...
...
@@ -53,6 +52,7 @@ services:
web_test:
build:
context: .
target: pastell_dev
args:
GITHUB_API_TOKEN: ${GITHUB_API_TOKEN:-}
ports:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment