+9
-2
@@ -1,2 +1,9 @@
|
||||
public/img
|
||||
storage
|
||||
.git
|
||||
vendor
|
||||
node_modules
|
||||
storage/logs
|
||||
storage/framework/cache/*
|
||||
storage/framework/sessions/*
|
||||
storage/framework/views/*
|
||||
storage/app/public
|
||||
.env
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Build and Deploy
|
||||
run-name: ${{ gitea.actor }} is building ${{ gitea.repository }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
- 'composer.json'
|
||||
- 'composer.lock'
|
||||
- '.gitea/workflows/build-docker.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
REGISTRY: git.nhgooi.nl
|
||||
IMAGE: git.nhgooi.nl/nh_gooi/nhgooi.nl
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | \
|
||||
docker login "$REGISTRY" \
|
||||
-u "${{ gitea.actor }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
-t "$IMAGE:${{ gitea.sha }}" \
|
||||
-t "$IMAGE:latest" \
|
||||
.
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
docker push "$IMAGE:${{ gitea.sha }}"
|
||||
docker push "$IMAGE:latest"
|
||||
|
||||
- name: Trigger deployment
|
||||
run: |
|
||||
curl --fail-with-body \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"image": "'"$IMAGE:${{ gitea.sha }}"'",
|
||||
"commit": "${{ gitea.sha }}",
|
||||
"repository": "${{ gitea.repository }}"
|
||||
}' \
|
||||
"${{ secrets.DEPLOY_WEBHOOK_URL }}"
|
||||
+56
-30
@@ -1,38 +1,64 @@
|
||||
FROM php:8.2-apache
|
||||
FROM php:8.3-apache
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
g++ \
|
||||
libcurl4-gnutls-dev \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
libzip-dev \
|
||||
zlib1g-dev \
|
||||
msmtp \
|
||||
unzip \
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
locales \
|
||||
--no-install-recommends \
|
||||
&& docker-php-ext-install pdo pdo_mysql mysqli xsl xml zip opcache \
|
||||
&& a2enmod rewrite proxy proxy_http headers \
|
||||
&& apt-get purge -y g++ \
|
||||
&& apt-get autoremove -y \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
curl \
|
||||
libicu-dev \
|
||||
libzip-dev \
|
||||
libonig-dev \
|
||||
libssh2-1 \
|
||||
libssh2-1-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Get latest Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
RUN pecl install ssh2 \
|
||||
&& docker-php-ext-enable ssh2 \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
intl \
|
||||
ftp \
|
||||
mbstring \
|
||||
bcmath \
|
||||
zip
|
||||
|
||||
# Update the default apache site with the config we created.
|
||||
ADD docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
|
||||
RUN a2enmod rewrite
|
||||
|
||||
WORKDIR /var/www/html
|
||||
COPY . /var/www/html
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
WORKDIR /var/www/app
|
||||
RUN mkdir -p storage/framework/{sessions,views,cache,cache/data} && \
|
||||
chown -R www-data:www-data storage/framework && \
|
||||
chmod -R 775 storage
|
||||
|
||||
#RUN php artisan cache:clear && \
|
||||
# php artisan config:clear && \
|
||||
# php artisan view:clear
|
||||
ENV APACHE_DOCUMENT_ROOT=/var/www/app/public
|
||||
|
||||
RUN sed -ri \
|
||||
-e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' \
|
||||
/etc/apache2/sites-available/*.conf \
|
||||
/etc/apache2/apache2.conf \
|
||||
/etc/apache2/conf-available/*.conf
|
||||
|
||||
RUN echo '<Directory /var/www/app/public>\n\
|
||||
AllowOverride All\n\
|
||||
Require all granted\n\
|
||||
</Directory>' > /etc/apache2/conf-available/laravel.conf \
|
||||
&& a2enconf laravel
|
||||
|
||||
COPY composer.json composer.lock ./
|
||||
|
||||
# Note: for Laravel, the COPY . . needs to be before the composer install
|
||||
COPY . .
|
||||
|
||||
RUN composer install \
|
||||
--no-dev \
|
||||
--prefer-dist \
|
||||
--no-interaction \
|
||||
--optimize-autoloader
|
||||
|
||||
RUN mkdir -p \
|
||||
storage/framework/cache/data \
|
||||
storage/framework/sessions \
|
||||
storage/framework/views \
|
||||
&& chown -R www-data:www-data storage bootstrap/cache \
|
||||
&& chmod -R ug+rwx storage bootstrap/cache
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user