website/Dockerfile

51 lines
1.9 KiB
Docker
Raw Normal View History

2021-05-13 23:15:00 +02:00
# Bootstrap SCSS
FROM node:latest AS buildJS
2021-01-11 14:10:09 +01:00
WORKDIR /build
COPY . /build
2021-01-11 20:20:57 +01:00
RUN mkdir /build/public/js
2021-01-12 09:41:03 +01:00
RUN mkdir /build/public/css
2021-02-28 12:23:22 +01:00
RUN yarn install
RUN yarn compile
2021-01-11 14:10:09 +01:00
2021-05-14 23:06:49 +02:00
# Install PHP dependencies
2021-05-13 23:15:00 +02:00
FROM composer:latest AS composer
WORKDIR /build
2021-05-14 00:08:48 +02:00
COPY --from=buildJS /build /build
2021-05-14 23:06:49 +02:00
RUN cd /build/public/API && composer install
2021-05-13 23:15:00 +02:00
2021-01-11 14:10:09 +01:00
# Prepare Webserver
2021-08-16 19:05:50 +02:00
FROM alpine:alpine
2020-12-28 22:36:25 +01:00
# |--------------------------------------------------------------------------
2021-08-16 17:11:03 +02:00
# | install dependencies
2020-12-28 22:36:25 +01:00
# |--------------------------------------------------------------------------
2021-08-16 17:11:03 +02:00
RUN apk update && \
apk upgrade && \
2021-08-16 19:05:50 +02:00
apk add apache2 php8-apache2 php8-mysqli curl
2021-01-02 11:43:54 +01:00
# |--------------------------------------------------------------------------
2021-03-24 23:46:18 +01:00
# | copy website from node build
2021-01-02 11:43:54 +01:00
# |--------------------------------------------------------------------------
2021-08-16 17:11:03 +02:00
COPY --from=composer /build/public /usr/local/apache2/htdocs/
2020-12-28 22:36:25 +01:00
2021-03-25 15:44:16 +01:00
# |--------------------------------------------------------------------------
# | enable apache modules
# |--------------------------------------------------------------------------
2021-08-16 17:11:03 +02:00
RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf && \
sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /usr/local/apache2/conf/httpd.conf
2021-03-25 15:44:16 +01:00
2021-07-16 15:40:49 +02:00
# |--------------------------------------------------------------------------
2021-08-16 17:11:03 +02:00
# | enable healthcheck
2021-07-16 15:40:49 +02:00
# |--------------------------------------------------------------------------
HEALTHCHECK CMD curl --fail http://localhost || exit 1
2021-01-02 11:43:54 +01:00
# |--------------------------------------------------------------------------
2021-03-24 23:46:18 +01:00
# | expose http port
2020-12-28 22:36:25 +01:00
# |--------------------------------------------------------------------------
2021-03-24 23:46:18 +01:00
EXPOSE 80
2021-08-16 19:05:50 +02:00
# |--------------------------------------------------------------------------
# | set entrypoint
# |--------------------------------------------------------------------------
COPY httpd-foreground /usr/local/bin/
CMD ["httpd-foreground"]