Docker and CICD
This commit is contained in:
+57
@@ -0,0 +1,57 @@
|
||||
# Composer dependencies
|
||||
FROM composer:2 AS vendor
|
||||
|
||||
WORKDIR /usr/app
|
||||
COPY . .
|
||||
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
||||
|
||||
# Build frontend assets
|
||||
# Install node and npm
|
||||
RUN apk add --no-cache nodejs npm
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
# Final PHP image
|
||||
FROM dunglas/frankenphp:1.12.2-php8.3-alpine AS final
|
||||
|
||||
# Install system dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
freetype-dev \
|
||||
oniguruma-dev \
|
||||
zip \
|
||||
unzip \
|
||||
git \
|
||||
curl \
|
||||
libpq-dev \
|
||||
php-pgsql
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo pgsql pdo_pgsql mbstring exif pcntl bcmath gd
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy app
|
||||
COPY . .
|
||||
|
||||
RUN mv .env.docker .env
|
||||
|
||||
# Copy dependencies
|
||||
COPY --from=vendor /usr/app/vendor ./vendor
|
||||
|
||||
# Copy built frontend
|
||||
COPY --from=vendor /usr/app/public/build ./public/build
|
||||
|
||||
# Permissions
|
||||
#RUN chown -R www-data:www-data /app
|
||||
#RUN chown www-data:www-data /app/dockerEntryPoint.sh
|
||||
RUN chmod +x /app/dockerEntryPoint.sh
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl -f http://127.0.0.1/up || exit 1
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["./dockerEntryPoint.sh"]
|
||||
Reference in New Issue
Block a user