website/Dockerfile
2021-08-16 19:27:55 +02:00

52 lines
No EOL
1.9 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 alpine:latest
# |--------------------------------------------------------------------------
# | install dependencies
# |--------------------------------------------------------------------------
RUN apk update && \
apk upgrade && \
apk add apache2 php8-apache2 php8-mysqli curl && \
rm /var/www/localhost/htdocs/ -R
# |--------------------------------------------------------------------------
# | copy website from node build
# |--------------------------------------------------------------------------
COPY --from=composer /build/public /var/www/localhost/htdocs/
# |--------------------------------------------------------------------------
# | enable apache modules
# |--------------------------------------------------------------------------
RUN sed -i '/LoadModule rewrite_module/s/^#//g' /etc/apache2/httpd.conf && \
sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /etc/apache2/httpd.conf
# |--------------------------------------------------------------------------
# | enable healthcheck
# |--------------------------------------------------------------------------
HEALTHCHECK CMD curl --fail http://localhost || exit 1
# |--------------------------------------------------------------------------
# | expose http port
# |--------------------------------------------------------------------------
EXPOSE 80
# |--------------------------------------------------------------------------
# | set entrypoint
# |--------------------------------------------------------------------------
COPY httpd-foreground /usr/local/bin/
CMD ["httpd-foreground"]