76 lines
2.2 KiB
Docker
76 lines
2.2 KiB
Docker
FROM composer:latest as vendor
|
|
|
|
WORKDIR /app
|
|
|
|
COPY composer.json composer.lock ./
|
|
|
|
RUN composer install \
|
|
--prefer-dist \
|
|
--no-dev \
|
|
--no-suggest \
|
|
--no-progress \
|
|
--no-autoloader \
|
|
--no-scripts \
|
|
--no-interaction \
|
|
--ignore-platform-reqs
|
|
|
|
FROM node:alpine as frontend
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json yarn.lock ./
|
|
RUN yarn install --frozen-lockfile
|
|
|
|
COPY postcss.config.js tsconfig.build.json tsconfig.json webpack.config.ts ./
|
|
COPY tools/*Plugin.ts ./tools/
|
|
|
|
COPY resources ./resources
|
|
|
|
RUN yarn build && \
|
|
cp resources/assets/src/images/bg.webp public/app/ && \
|
|
cp resources/assets/src/images/favicon.ico public/app/ && \
|
|
# Strip unused files
|
|
rm -rf *.config.js *.config.ts tsconfig.* \
|
|
package.json yarn.lock node_modules/ \
|
|
resources/assets/ resources/lang resources/misc resources/misc/backgrounds/ \
|
|
tools/
|
|
|
|
FROM composer:latest as builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . ./
|
|
|
|
COPY --from=vendor /app ./
|
|
COPY --from=frontend /app/public ./public
|
|
COPY --from=frontend /app/resources/views/assets ./resources/views/assets
|
|
|
|
RUN composer dump-autoload -o --no-dev -n && \
|
|
rm -rf *.config.js *.config.ts tsconfig.* \
|
|
package.json yarn.lock node_modules/ \
|
|
resources/assets/ resources/misc resources/misc/backgrounds/ \
|
|
tools/ && \
|
|
mv .env.example .env && \
|
|
mv .env storage/ && \
|
|
ln -s storage/.env .env && \
|
|
mkdir storage/plugins
|
|
|
|
FROM php:8-apache
|
|
|
|
RUN apt update && apt install wget -y && cd /usr/local/bin && wget -c https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions
|
|
|
|
RUN chmod +x /usr/local/bin/install-php-extensions && \
|
|
export http_proxy=http://127.0.0.1:7890 && \
|
|
export https_proxy=http://127.0.0.1:7890 && \
|
|
install-php-extensions gd zip pdo_pgsql pgsql pdo_mysql
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app ./
|
|
|
|
ENV APACHE_DOCUMENT_ROOT /app/public
|
|
RUN chown -R www-data:www-data . && \
|
|
sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \
|
|
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
|
|
a2enmod rewrite headers
|