Compare commits
6 Commits
4fd2ca42dd
...
10.0.20
| Author | SHA1 | Date | |
|---|---|---|---|
|
395cae112a
|
|||
|
e24e2b3d5b
|
|||
|
2cb032520a
|
|||
|
604863c39c
|
|||
|
4218c4fac3
|
|||
|
990ac9e0a8
|
129
.drone.star
129
.drone.star
@@ -1,129 +0,0 @@
|
||||
def main(ctx):
|
||||
archs = ["amd64", "arm64"] ## arm
|
||||
glpi_version = "10.0.18"
|
||||
alpine_version = "3.21"
|
||||
|
||||
out = []
|
||||
for arch in archs:
|
||||
out += onpush(ctx, glpi_version, alpine_version, arch)
|
||||
|
||||
for arch in archs:
|
||||
out += build_publish(ctx, glpi_version, alpine_version, arch)
|
||||
|
||||
out += manifest_publish(ctx, glpi_version, archs)
|
||||
|
||||
return out
|
||||
|
||||
def onpush(ctx, glpi_version, alpine_version, arch):
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "build-onpush-%s-%s" % (glpi_version, arch),
|
||||
"platform": {
|
||||
"arch": arch,
|
||||
"os": "linux",
|
||||
},
|
||||
"steps": [{
|
||||
"name": "build_on_push",
|
||||
"image": "plugins/docker:linux-%s" % (arch),
|
||||
"settings": {
|
||||
"context": "src",
|
||||
"dockerfile": "src/Dockerfile",
|
||||
"dry_run": True,
|
||||
"repo": "docker.asperti.com/paspo/glpi",
|
||||
"build_args": [
|
||||
"GLPI_VERSION=%s" % (glpi_version),
|
||||
"ALPINE_VERSION=%s" % (alpine_version)
|
||||
],
|
||||
},
|
||||
}],
|
||||
"trigger": {
|
||||
"event": ['push'],
|
||||
}
|
||||
}]
|
||||
|
||||
def build_publish(ctx, glpi_version, alpine_version, arch):
|
||||
major = glpi_version.partition(".")[0];
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "build-publish-%s-%s" % (glpi_version, arch),
|
||||
"platform": {
|
||||
"arch": arch,
|
||||
"os": "linux",
|
||||
},
|
||||
"steps": [{
|
||||
"name": "build_on_push",
|
||||
"image": "plugins/docker:linux-%s" % (arch),
|
||||
"settings": {
|
||||
"context": "src",
|
||||
"dockerfile": "src/Dockerfile",
|
||||
"build_args": [
|
||||
"GLPI_VERSION=%s" % (glpi_version),
|
||||
"ALPINE_VERSION=%s" % (alpine_version)
|
||||
],
|
||||
"username": {
|
||||
"from_secret": "docker_username",
|
||||
},
|
||||
"password": {
|
||||
"from_secret": "docker_password",
|
||||
},
|
||||
"registry": "docker.asperti.com",
|
||||
"repo": "docker.asperti.com/paspo/glpi",
|
||||
"tags": [
|
||||
"latest-%s" % (arch),
|
||||
"%s-%s" % (major, arch),
|
||||
"%s-%s" % (glpi_version, arch)
|
||||
],
|
||||
"auto_tag": False,
|
||||
"force_tag": True,
|
||||
"daemon_off": False,
|
||||
},
|
||||
}],
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/master",
|
||||
"refs/tags/**",
|
||||
],
|
||||
},
|
||||
}]
|
||||
|
||||
def manifest_publish(ctx, glpi_version, archs):
|
||||
major = glpi_version.partition(".")[0];
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "manifest-%s" % (glpi_version),
|
||||
"platform": {
|
||||
"arch": archs[0],
|
||||
"os": "linux",
|
||||
},
|
||||
"steps": [{
|
||||
"name": "manifest",
|
||||
"image": "plugins/manifest",
|
||||
"settings": {
|
||||
"spec": "manifest.tmpl",
|
||||
"username": {
|
||||
"from_secret": "docker_username",
|
||||
},
|
||||
"password": {
|
||||
"from_secret": "docker_password",
|
||||
},
|
||||
"tags": [
|
||||
"latest",
|
||||
major,
|
||||
glpi_version
|
||||
],
|
||||
"ignore_missing": True,
|
||||
"force_tag": True,
|
||||
},
|
||||
}],
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/master",
|
||||
"refs/tags/**",
|
||||
],
|
||||
},
|
||||
"depends_on": ["build-publish-%s-%s" % (glpi_version, arch) for arch in archs]
|
||||
}]
|
||||
|
||||
98
.gitea/workflows/build_and_publish.yaml
Normal file
98
.gitea/workflows/build_and_publish.yaml
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
name: Container Publish
|
||||
|
||||
env:
|
||||
REGISTRY: docker.asperti.com
|
||||
REPOSITORY: paspo/glpi
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: "0 12 3 * *"
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
workflow_run:
|
||||
workflows: [vulnscan.yaml]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
on-success-skip:
|
||||
runs-on:
|
||||
labels: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- run: exit_with_success
|
||||
|
||||
build-image:
|
||||
runs-on:
|
||||
labels: [ubuntu-latest, "arch-${{ matrix.arch }}"]
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and publish
|
||||
run: |
|
||||
cd src && \
|
||||
docker build \
|
||||
--tag ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest-${{ matrix.arch }} \
|
||||
--tag ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10-${{ matrix.arch }} \
|
||||
--tag ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10.0.20-${{ matrix.arch }} \
|
||||
--build-arg "GLPI_VERSION=10.0.20" \
|
||||
--build-arg "ALPINE_VERSION=3.21" \
|
||||
--platform linux/${{ matrix.arch }} -f Dockerfile .
|
||||
docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest-${{ matrix.arch }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10-${{ matrix.arch }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10.0.20-${{ matrix.arch }}
|
||||
|
||||
manifest:
|
||||
name: update docker manifest
|
||||
needs: build-image
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
steps:
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: latest
|
||||
run: |
|
||||
docker manifest create \
|
||||
${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest \
|
||||
--amend ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest-amd64 \
|
||||
--amend ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest-arm64
|
||||
docker manifest push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest
|
||||
|
||||
- name: "10"
|
||||
run: |
|
||||
docker manifest create \
|
||||
${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10 \
|
||||
--amend ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10-amd64 \
|
||||
--amend ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10-arm64
|
||||
docker manifest push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10
|
||||
|
||||
- name: "10.0.20"
|
||||
run: |
|
||||
docker manifest create \
|
||||
${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10.0.20 \
|
||||
--amend ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10.0.20-amd64 \
|
||||
--amend ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10.0.20-arm64
|
||||
docker manifest push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:10.0.20
|
||||
@@ -1,21 +1,33 @@
|
||||
---
|
||||
name: Vulnerability Scan
|
||||
|
||||
env:
|
||||
REGISTRY: docker.asperti.com
|
||||
REPOSITORY: paspo/glpi
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 14 * * *"
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
workflow_run:
|
||||
workflows: [build_and_publish.yaml]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
scan:
|
||||
name: Daily Vulnerability Scan
|
||||
runs-on: ubuntu-latest
|
||||
runs-on:
|
||||
labels: [ubuntu-latest, "arch-${{ matrix.arch }}"]
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
|
||||
steps:
|
||||
- name: Pull docker image
|
||||
run: docker pull docker.asperti.com/paspo/glpi:latest
|
||||
run: docker pull ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest
|
||||
|
||||
- name: Setup trivy
|
||||
run: |
|
||||
@@ -32,7 +44,7 @@ jobs:
|
||||
- name: Run Trivy vulnerability scanner
|
||||
id: scan
|
||||
run: |
|
||||
trivy --server ${{ secrets.TRIVY_SERVER }} --token ${{ secrets.TRIVY_TOKEN }} image --format json docker.asperti.com/paspo/glpi:latest > trivy-results.json
|
||||
trivy --server ${{ secrets.TRIVY_SERVER }} --token ${{ secrets.TRIVY_TOKEN }} image --format json ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest > trivy-results.json
|
||||
|
||||
# if some vulnerability is found, we fail
|
||||
- name: check output
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
image: docker.asperti.com/paspo/glpi:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: docker.asperti.com/paspo/glpi:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: docker.asperti.com/paspo/glpi:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-arm64
|
||||
platform:
|
||||
variant: v8
|
||||
architecture: arm64
|
||||
os: linux
|
||||
-
|
||||
image: docker.asperti.com/paspo/glpi:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-arm
|
||||
platform:
|
||||
variant: v7
|
||||
architecture: arm
|
||||
os: linux
|
||||
@@ -13,6 +13,9 @@ RUN \
|
||||
chmod +x /usr/local/bin/composer && \
|
||||
wget -O - https://github.com/glpi-project/glpi/releases/download/${GLPI_VERSION}/glpi-${GLPI_VERSION}.tgz | tar xz -C /var/www
|
||||
|
||||
# GLPI 10.x will work only with PHP up to 8.3.
|
||||
# do not trust README.md from glpi github (it says it works with 8.4, but it dies if >=8.4.0)
|
||||
|
||||
# this are needed if you want to manually install GLPI from git
|
||||
# RUN \
|
||||
# apk add patch npm gettext
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
INSTALL_OK=${INSTALL_OK:-0}
|
||||
|
||||
chown -R nginx:www-data /logs /config /files /marketplace
|
||||
chmod -R a-x,a=rX,ug+w /logs /config /files /marketplace
|
||||
|
||||
if [ "$INSTALL_OK" = "1" ] ; then
|
||||
if [ "${INSTALL_OK}" = "1" ] ; then
|
||||
if [ -f /var/www/glpi/install/install.php ] ; then
|
||||
rm /var/www/glpi/install/install.php
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user