Files
DatBrowser/Dockerfile
Matthias Guillitte 1c3c4b1257
All checks were successful
Push image to registry / build-image (push) Successful in 3m46s
Cache when running
2025-02-08 11:16:40 +01:00

88 lines
2.4 KiB
Docker

# INSTALL PHP COMPOSER DEPENDENCIES
FROM composer:lts AS composer-deps
WORKDIR /
# If your composer.json file defines scripts that run during dependency installation and
# reference your application source files, uncomment the line below to copy all the files
# into this layer.
# COPY composer.json composer.lock ./
COPY . .
# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a bind mounts to composer.json and composer.lock to avoid having to copy them
# into this layer.
# Leverage a cache mount to /tmp/cache so that subsequent builds don't have to re-download packages.
RUN --mount=type=bind,source=composer.json,target=composer.json \
--mount=type=bind,source=composer.lock,target=composer.lock \
--mount=type=cache,target=/tmp/cache \
composer install --no-interaction --prefer-dist
# ========================================
# BUILD VUE APP
FROM node:20 AS build-vue
WORKDIR /usr/app
# COPY package.json tsconfig.json tailwind.config.js vite.config.js ./
# COPY resources/ ./resources/
COPY . .
RUN mv .env.docker .env
COPY --from=composer-deps /vendor/ ./vendor
RUN mkdir -p public/build/ && npm i && npm run build
# ========================================
# RUN
FROM php:8.2-alpine AS final
ARG APP_ENV_FILE=.env.docker
# Install system dependencies
RUN apk update && apk add --no-cache \
git \
curl \
libpng-dev \
libxml2-dev \
libzip-dev \
zip \
unzip \
supervisor \
nginx \
openssl \
linux-headers
RUN docker-php-ext-configure zip && docker-php-ext-install zip
RUN docker-php-ext-install gd pdo pdo_mysql zip
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
COPY . .
COPY --from=build-vue /usr/app/public/build ./public/build
RUN mv ${APP_ENV_FILE} .env
# DUSK
# RUN php artisan dusk:install && php artisan dusk:chrome-driver && mv ./undetectedChromedriver/chromedriver-linux ./vendor/laravel/dusk/bin/chromedriver-linux
# RUN php artisan dusk:install && php artisan dusk:chrome-driver
# RUN php artisan dusk:install
RUN composer install --no-interaction --prefer-dist
# CRON
RUN echo "* * * * * cd /usr/app && php artisan schedule:run >> /dev/null 2>&1" > /etc/crontabs/root
# Link the storage directory to the public directory.
RUN php artisan storage:link
RUN chmod +x ./dockerEntryPoint.sh
EXPOSE 80
CMD ["./dockerEntryPoint.sh"]