+9
-2
@@ -1,2 +1,9 @@
|
|||||||
public/img
|
.git
|
||||||
storage
|
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 \
|
RUN apt-get update && apt-get install -y \
|
||||||
&& apt-get -y install \
|
|
||||||
g++ \
|
|
||||||
libcurl4-gnutls-dev \
|
|
||||||
libxml2-dev \
|
|
||||||
libxslt-dev \
|
|
||||||
libzip-dev \
|
|
||||||
zlib1g-dev \
|
|
||||||
msmtp \
|
|
||||||
unzip \
|
|
||||||
git \
|
git \
|
||||||
locales \
|
curl \
|
||||||
--no-install-recommends \
|
libicu-dev \
|
||||||
&& docker-php-ext-install pdo pdo_mysql mysqli xsl xml zip opcache \
|
libzip-dev \
|
||||||
&& a2enmod rewrite proxy proxy_http headers \
|
libonig-dev \
|
||||||
&& apt-get purge -y g++ \
|
libssh2-1 \
|
||||||
&& apt-get autoremove -y \
|
libssh2-1-dev \
|
||||||
&& rm -r /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Get latest Composer
|
RUN pecl install ssh2 \
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
&& 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.
|
RUN a2enmod rewrite
|
||||||
ADD docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
|
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||||
COPY . /var/www/html
|
|
||||||
|
|
||||||
WORKDIR /var/www/app
|
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 && \
|
ENV APACHE_DOCUMENT_ROOT=/var/www/app/public
|
||||||
# php artisan config:clear && \
|
|
||||||
# php artisan view:clear
|
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