Updated docker

This commit is contained in:
Jeroen De Meerleer 2022-04-29 14:49:31 +02:00
parent 6e96e1e731
commit 0a0574b2e4
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 70 additions and 7 deletions

61
.env Normal file
View File

@ -0,0 +1,61 @@
################
### DEFAULT ###
################
## What kind of environment. Only use prod here.
APP_ENV=prod
################
### DATABASE ###
################
## We're using a database. Look at the url below to create a database URL
## https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
DATABASE_URL="sqlite:///:memory:"
##################
### ENCRYPTION ###
##################
## WARNING: Consider your already saved secrets lost when changing below values
## This secret value is used to encrypt secret variables (eg. ssh-keys, http-auth passwords, etc)
APP_SECRET="7-!)U`R\H31LBEI2wu7iWNY,f!Y\$P&VO)%r1`FQ"
## The encryption method used for encrypting secret variables. AES-256 is most commonly used and considered most safe.
## Please see https://www.php.net/openssl-get-cipher-methods for possible values
ENCRYPTION_METHOD="AES-256-CBC"
## Hashing methods algorithms to save passwords.
## By saving a hash instead of plain-text password your password is kept safe as hashing is considered to be inreversable
## Additionally when saving a secret variable, a hash of the secret value is calculated as well to ensure
## the encrypted data is not tampered
HASHING_METHOD="sha256"
###################
### ENVIRONMENT ###
###################
## Debug mode is solely for development purposes only. It disables caching and enables your webcam to stream it to the web
DEBUG=false
## Cookies are used for saving autologin credentials. This sets the amount of time in seconds the credentials are saved.
## Grandma probably has a calculator somewhere if you need to check how many seconds are in a week :)
COOKIE_LIFETIME=2592000
## Unfortunatly, not everyone has the same timezone. 3:00PM in Sydney, does not mean it is 15:00 in Brussels.
## You can change this here. Need help? https://www.php.net/timezones
TZ=Europe/Brussels
## TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy.
## Set it to the IP address of your proxy. You can set to multiple proxies by comma-separating them
TRUSTED_PROXIES=192.168.1.100
##############
### MAILER ###
##############
## Webcron management is sending you mails when cronjob are failing. The MAILER_DSN is providing usefull information on
## the how mails are being sent. Need info? https://symfony.com/doc/current/mailer.html#transport-setup
MAILER_DSN=smtp://morphy.jeroened.be:25
## Anonymous is still someone. So even if this someone is unknown you need someone who is sending your mails.
MAILER_FROM=webcron@jeroened.be
## Now that everything is set up: go to your friends and get wasted!

View File

@ -1,20 +1,21 @@
FROM php:8.0-apache AS phpbuilder
FROM php:8.1-apache AS phpbuilder
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /tmp/buildir/
RUN apt-get update -y && apt-get install -y git libzip-dev
RUN docker-php-ext-install zip
RUN apt-get update -y && apt-get install -y git libzip-dev libicu-dev
RUN docker-php-ext-install zip intl pcntl pdo
RUN git clone https://git.jeroened.be/webcron/webcron.git
WORKDIR /tmp/buildir/webcron
COPY .env /tmp/buildir/webcron/.env
RUN composer install
FROM node:14 as nodebuilder
FROM node:16 as nodebuilder
COPY --from=phpbuilder /tmp/buildir/webcron /tmp/buildir/webcron
WORKDIR /tmp/buildir/webcron
RUN npm install
RUN npx encore prod
RUN rm -rf node_modules
FROM php:8.0-apache
FROM php:8.1-apache
ENV APACHE_DOCUMENT_ROOT=/var/www/webcron/public/
ENV WEBCRON_ROOT=/var/www/webcron/
ENV TZ=Europe/Brussels
@ -28,9 +29,10 @@ RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-av
RUN sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN a2enmod rewrite
RUN docker-php-ext-install pcntl
RUN apt-get update -y && apt-get install -y libicu-dev
RUN docker-php-ext-install intl pcntl pdo pdo_mysql
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN printf "[PHP]\ndate.timezone = \"$TZ\"\n" > /usr/local/etc/php/conf.d/tzone.ini
ENTRYPOINT service apache2 restart && php ${WEBCRON_ROOT}webcron daemon
ENTRYPOINT service apache2 restart && php ${WEBCRON_ROOT}bin/console daemon