website/Dockerfile
2021-07-16 13:40:49 +00:00

49 lines
1.7 KiB
Docker

# Bootstrap SCSS
FROM node:latest AS buildJS
WORKDIR /build
COPY . /build
RUN mkdir /build/public/js
RUN mkdir /build/public/css
RUN yarn install
RUN yarn compile
# Install PHP dependencies
FROM composer:latest AS composer
WORKDIR /build
COPY --from=buildJS /build /build
RUN cd /build/public/API && composer install
# Prepare Webserver
FROM php:8-apache-buster
# |--------------------------------------------------------------------------
# | install php extensions
# |--------------------------------------------------------------------------
RUN docker-php-ext-install mysqli
# |--------------------------------------------------------------------------
# | enable production php ini
# |--------------------------------------------------------------------------
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# |--------------------------------------------------------------------------
# | copy website from node build
# |--------------------------------------------------------------------------
COPY --from=composer /build/public /var/www/html
# |--------------------------------------------------------------------------
# | enable apache modules
# |--------------------------------------------------------------------------
RUN a2enmod headers rewrite
# |--------------------------------------------------------------------------
# | enable metrics
# |--------------------------------------------------------------------------
RUN apt update && apt install curl
HEALTHCHECK CMD curl --fail http://localhost || exit 1
# |--------------------------------------------------------------------------
# | expose http port
# |--------------------------------------------------------------------------
EXPOSE 80