Merge branch 'Xbird/Dockerfile' into 'main'

add docker file

See merge request gamexperience/vision!8
This commit is contained in:
Xbird
2022-03-28 16:19:42 +00:00
3 changed files with 55 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ stages:
- SecurityChecker
- CodingStandards
- UnitTests
- publish
security-checker:
stage: SecurityChecker
@@ -38,3 +39,24 @@ twig-lint:
script:
- twig-lint --version && twig-lint lint ./templates
allow_failure: false
publish:
stage: publish
image: docker:dind
services:
- docker:dind
only:
- main
variables:
DOCKER_DRIVER: overlay2
registry_host: ''
registry_user: ''
registry_pass: ''
registry_img: ''
before_script:
- apk add jq
script:
- APP_VERSION=$(cat package.json | jq .version -r)
- docker login $registry_host -u $registry_user -p $registry_pass
- docker build -f ./Dockerfile -t $registry_host/$registry_img:$APP_VERSION .
- docker push $registry_host/$registry_img:$APP_VERSION

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM php:8-apache
COPY . .
ENV DATABASE_URL=localhost
# Apk install
RUN apt update -y && apt install zip wget -y
# Install pdo
RUN docker-php-ext-install pdo_mysql
# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php composer-setup.php && php -r "unlink('composer-setup.php');" && mv composer.phar /usr/local/bin/composer
RUN composer install -n --no-scripts
RUN chown -R www-data:www-data /var/www/html/var
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN chmod +x start.sh
WORKDIR /var/www/html
ENTRYPOINT ["./start.sh"]

6
start.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console cache:clear
a2enmod rewrite
chown www-data:www-data ./public/uploads
/usr/sbin/apachectl -D FOREGROUND