added docker build files
Some checks failed
Tests / PHP ${{ matrix.php }} (8.1) (push) Has been cancelled
Tests / PHP ${{ matrix.php }} (8.2) (push) Has been cancelled

This commit is contained in:
2024-09-22 23:11:43 +05:00
parent 79dcd973c7
commit 56ffe2c3d1
5 changed files with 148 additions and 0 deletions

36
.build/fpm.Dockerfile Normal file
View File

@@ -0,0 +1,36 @@
FROM composer:2.7.9 AS composer
FROM git.shihaam.dev/dockerfiles/php-fpm:8.2 AS composerinstall
WORKDIR /var/www/html
COPY .. /var/www/html
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN --mount=type=cache,target=/root/.composer/cache \
composer install --no-interaction --no-dev --optimize-autoloader
FROM git.shihaam.dev/dockerfiles/php-fpm:8.2
# Use bash as the default shell
SHELL ["/bin/bash", "-c"]
WORKDIR /var/www/html
COPY --from=composerinstall /var/www/html /var/www/html/
# Set the git envs
ARG CI_COMMIT_SHORT_SHA
ARG CI_COMMIT_SHA
ARG CI_COMMIT_BRANCH
ENV CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
ENV CI_COMMIT_SHA=$CI_COMMIT_SHA
ENV CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
RUN chown -R www-data:www-data storage/ \
&& chmod -R ug+rw storage \
&& chmod -R ug+x storage/framework storage/logs \
&& chmod -R ug+rw bootstrap/cache \
&& chmod -R ug+x bootstrap/cache
RUN php artisan storage:link
# expose public dir for nginx to serve static files
VOLUME /var/www/html/public