website/Dockerfile

61 lines
2 KiB
Text
Raw Normal View History

2021-01-11 16:18:10 +01:00
# Bootstrap SCSS
FROM ruby:latest AS build-scss
2021-01-11 14:10:09 +01:00
WORKDIR /build
COPY . /build
2021-01-11 14:26:30 +01:00
RUN mkdir /build/public/css
2021-01-11 14:10:09 +01:00
RUN gem install sass
2021-01-11 16:29:59 +01:00
RUN sass --update scss:public/css --style compressed
2021-01-11 14:10:09 +01:00
2021-01-11 20:20:57 +01:00
# Bootstrap TypeScript
FROM tedneward/typescript AS build-ts
WORKDIR /build
COPY --from=build-scss /build /build
USER root
RUN mkdir /build/public/js
RUN tsc
2021-01-11 14:10:09 +01:00
# Prepare Webserver
2020-12-28 22:49:56 +01:00
ARG INSTALL_CRON=0
ARG INSTALL_COMPOSER=0
2020-12-28 22:36:25 +01:00
ARG PHP_VERSION
ARG GLOBAL_VERSION
FROM thecodingmachine/php:8.0-v4-slim-apache
# |--------------------------------------------------------------------------
# | Main PHP extensions
# |--------------------------------------------------------------------------
# |
# | Installs the main PHP extensions
# |
USER root
RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh
2020-12-28 22:36:25 +01:00
USER docker
# |--------------------------------------------------------------------------
# | Default PHP extensions to be enabled (in addition to the one declared in Slim build)
# |--------------------------------------------------------------------------
2020-12-28 22:41:58 +01:00
ENV PHP_EXTENSION_APCU=0 \
2020-12-28 22:36:25 +01:00
PHP_EXTENSION_MYSQLI=1 \
2020-12-28 22:41:58 +01:00
PHP_EXTENSION_PDO_MYSQL=0 \
PHP_EXTENSION_IGBINARY=0 \
PHP_EXTENSION_REDIS=0 \
2021-01-02 11:43:54 +01:00
PHP_EXTENSION_SOAP=0
# |--------------------------------------------------------------------------
# | Enable production config files
# |--------------------------------------------------------------------------
ENV APP_ENV=prod \
TEMPLATE_PHP_INI=production \
2020-12-28 23:01:50 +01:00
PHP_INI_ERROR_REPORTING=0
2020-12-28 22:36:25 +01:00
2021-01-02 11:43:54 +01:00
# |--------------------------------------------------------------------------
# | Run Apache as www-data for more security
# |--------------------------------------------------------------------------
ENV APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data \
APACHE_EXTENSIONS=headers
2020-12-28 22:36:25 +01:00
# |--------------------------------------------------------------------------
# | Add php files of website
# |--------------------------------------------------------------------------
2021-01-11 20:20:57 +01:00
COPY --from=build-ts /build/public /var/www/html