37 lines
1012 B
Docker
37 lines
1012 B
Docker
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
|