46 - Add CI image and app image build workflows
This commit is contained in:
parent
c4ae6c2e69
commit
abac8509cb
4 changed files with 116 additions and 2 deletions
42
.forgejo/workflows/build.yml
Normal file
42
.forgejo/workflows/build.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://data.forgejo.org/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Forgejo Registry
|
||||
uses: https://data.forgejo.org/docker/login-action@v3
|
||||
with:
|
||||
registry: forge.lvl0.xyz
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Determine tags
|
||||
id: meta
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
TAG="${{ github.ref_name }}"
|
||||
echo "tags=forge.lvl0.xyz/lvl0/dishplanner:${TAG},forge.lvl0.xyz/lvl0/dishplanner:latest" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "tags=forge.lvl0.xyz/lvl0/dishplanner:latest" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Build and push
|
||||
uses: https://data.forgejo.org/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
44
.forgejo/workflows/images.yml
Normal file
44
.forgejo/workflows/images.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
name: Build and Push Base Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'docker/build/**'
|
||||
- '.forgejo/workflows/images.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
images:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- name: dishplanner-ci
|
||||
file: docker/build/Dockerfile.ci
|
||||
version: php8.3-1
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://data.forgejo.org/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Forgejo Registry
|
||||
uses: https://data.forgejo.org/docker/login-action@v3
|
||||
with:
|
||||
registry: forge.lvl0.xyz
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: https://data.forgejo.org/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ${{ matrix.file }}
|
||||
push: true
|
||||
tags: |
|
||||
forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ matrix.version }}
|
||||
forge.lvl0.xyz/lvl0/${{ matrix.name }}:latest
|
||||
forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }}
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
|
|
@ -6,6 +6,4 @@
|
|||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
|
|
|||
30
docker/build/Dockerfile.ci
Normal file
30
docker/build/Dockerfile.ci
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# CI image: PHP + Composer only, no runtime server or frontend toolchain.
|
||||
# Tests run against SQLite in memory (see .env.testing), so no database client
|
||||
# or cache extension is needed.
|
||||
#
|
||||
# Published as dishplanner-ci:php8.3-<revision>. Bump the revision in the tag
|
||||
# and in .forgejo/workflows/ci.yml whenever this file changes (runners cache
|
||||
# mutable tags and will not re-pull them).
|
||||
#
|
||||
# Debian-based rather than Alpine to avoid the DNS resolution timeouts against
|
||||
# codeload.github.com that the Alpine base hit during composer install.
|
||||
|
||||
FROM php:8.3-cli
|
||||
|
||||
COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/local/bin/
|
||||
|
||||
RUN install-php-extensions \
|
||||
pdo_sqlite \
|
||||
mbstring \
|
||||
dom \
|
||||
xml \
|
||||
fileinfo \
|
||||
pcntl
|
||||
|
||||
# git is needed by the checkout action; nodejs runs the Forgejo JavaScript
|
||||
# actions (checkout, cache); unzip lets Composer extract dist archives.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends git unzip nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
Loading…
Reference in a new issue