Write build pipeline.
This commit is contained in:
45
.gitea/workflows/release.yml
Normal file
45
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Build project's laravel image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: cs-registry.ddnss.de
|
||||
USER: chris
|
||||
PASS: q',\H(Od:G3).Xv<#!5P
|
||||
|
||||
|
||||
jobs:
|
||||
Build-and-release-image:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log into registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: https://cs-git.ddnss.de
|
||||
username: ${{ env.USER }}
|
||||
password: ${{ env.PASS }}
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: cs-git.ddnss.de/ri-st/project
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
env:
|
||||
ACTIONS_RUNTIME_TOKEN: ''
|
||||
with:
|
||||
tags: cs-git.ddnss.de/ri-st/project:master
|
||||
push: true
|
||||
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
#Composer part
|
||||
FROM composer:2 AS composer-build
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY . .
|
||||
RUN composer install --no-dev --no-scripts --ignore-platform-reqs
|
||||
RUN composer dumpautoload --optimize
|
||||
|
||||
#NPM part
|
||||
FROM node:21 AS npm-build
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY --from=composer-build /var/www/html /var/www/html
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
#Use prebuilt image
|
||||
FROM cs-git.ddnss.de/docker/php-apache-8-4:latest AS final
|
||||
WORKDIR /var/www
|
||||
COPY --from=npm-build /var/www/html /var/www
|
||||
|
||||
RUN sed -ri -e 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/*.conf
|
||||
RUN sed -ri -e 's!/var/www/!/var/www/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
||||
RUN sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
RUN sed -ri -e 's!upload_max_filesize = 2M!upload_max_filesize = 8M!g' $PHP_INI_DIR/php.ini
|
||||
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN php artisan storage:link
|
||||
|
||||
RUN chown -R www-data:www-data /var/www
|
||||
|
||||
VOLUME /var/www/storage/app/public
|
||||
Reference in New Issue
Block a user