Add forgejo actions #486
6 changed files with 171 additions and 329 deletions
141
.drone.star
141
.drone.star
|
@ -1,141 +0,0 @@
|
||||||
def main(ctx):
|
|
||||||
return [
|
|
||||||
lint(),
|
|
||||||
default_tests("1.7", "1.7"),
|
|
||||||
default_tests("1.7-prod", "1.7", "Dockerfile.prod"),
|
|
||||||
release("1.7", "1.7", custom_tags = "latest"),
|
|
||||||
release("1.7-prod", "1.7", "Dockerfile.prod", "prod", "latest-prod"),
|
|
||||||
]
|
|
||||||
|
|
||||||
def lint():
|
|
||||||
return {
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "lint",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "Lint Dockerfiles",
|
|
||||||
"image": "hadolint/hadolint:latest-debian",
|
|
||||||
"pull": "if-not-exists",
|
|
||||||
"commands": [
|
|
||||||
"hadolint --version",
|
|
||||||
"hadolint */Dockerfile*",
|
|
||||||
],
|
|
||||||
"when": {
|
|
||||||
"status": [
|
|
||||||
"failure",
|
|
||||||
"success",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Lint entrypoint scripts",
|
|
||||||
"image": "koalaman/shellcheck-alpine",
|
|
||||||
"pull": "if-not-exists",
|
|
||||||
"commands": [
|
|
||||||
"shellcheck --version",
|
|
||||||
"shellcheck entrypoint*.sh",
|
|
||||||
],
|
|
||||||
"when": {
|
|
||||||
"status": [
|
|
||||||
"failure",
|
|
||||||
"success",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"trigger": {
|
|
||||||
"event": [
|
|
||||||
"pull_request",
|
|
||||||
"push",
|
|
||||||
],
|
|
||||||
"ref": {
|
|
||||||
"exclude": [
|
|
||||||
"refs/heads/renovate/*",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def default_tests(name, grav_version, dockerfile = "Dockerfile"):
|
|
||||||
return {
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "default_tests_%s" % name,
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "build test",
|
|
||||||
"image": "thegeeklab/drone-docker-buildx",
|
|
||||||
"pull": "if-not-exists",
|
|
||||||
"settings": {
|
|
||||||
"dockerfile": "%s/%s" % (grav_version, dockerfile),
|
|
||||||
"username": {
|
|
||||||
"from_secret": "dockerhub_username",
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"from_secret": "dockerhub_password_ro",
|
|
||||||
},
|
|
||||||
"dry_run": "true",
|
|
||||||
"platforms": "linux/amd64,linux/arm64",
|
|
||||||
"repo": "mwalbeck/getgrav",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"trigger": {
|
|
||||||
"event": [
|
|
||||||
"pull_request",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"depends_on": [
|
|
||||||
"lint",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
def release(name, grav_version, dockerfile = "Dockerfile", app_env = "", custom_tags = ""):
|
|
||||||
return {
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "release_%s" % name,
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "determine tags",
|
|
||||||
"image": "mwalbeck/determine-docker-tags",
|
|
||||||
"pull": "if-not-exists",
|
|
||||||
"environment": {
|
|
||||||
"VERSION_TYPE": "docker_env",
|
|
||||||
"APP_NAME": "GRAV",
|
|
||||||
"DOCKERFILE_PATH": "%s/%s" % (grav_version, dockerfile),
|
|
||||||
"APP_ENV": app_env,
|
|
||||||
"CUSTOM_TAGS": custom_tags,
|
|
||||||
"INCLUDE_MAJOR": "negative",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "build and publish",
|
|
||||||
"image": "thegeeklab/drone-docker-buildx",
|
|
||||||
"pull": "if-not-exists",
|
|
||||||
"settings": {
|
|
||||||
"dockerfile": "%s/%s" % (grav_version, dockerfile),
|
|
||||||
"username": {
|
|
||||||
"from_secret": "dockerhub_username",
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"from_secret": "dockerhub_password",
|
|
||||||
},
|
|
||||||
"platforms": "linux/amd64,linux/arm64",
|
|
||||||
"repo": "mwalbeck/getgrav",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"trigger": {
|
|
||||||
"branch": [
|
|
||||||
"master",
|
|
||||||
],
|
|
||||||
"event": [
|
|
||||||
"push",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"depends_on": [
|
|
||||||
"lint",
|
|
||||||
],
|
|
||||||
}
|
|
188
.drone.yml
188
.drone.yml
|
@ -1,188 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: lint
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Lint Dockerfiles
|
|
||||||
pull: if-not-exists
|
|
||||||
image: hadolint/hadolint:latest-debian
|
|
||||||
commands:
|
|
||||||
- hadolint --version
|
|
||||||
- hadolint */Dockerfile*
|
|
||||||
when:
|
|
||||||
status:
|
|
||||||
- failure
|
|
||||||
- success
|
|
||||||
|
|
||||||
- name: Lint entrypoint scripts
|
|
||||||
pull: if-not-exists
|
|
||||||
image: koalaman/shellcheck-alpine
|
|
||||||
commands:
|
|
||||||
- shellcheck --version
|
|
||||||
- shellcheck entrypoint*.sh
|
|
||||||
when:
|
|
||||||
status:
|
|
||||||
- failure
|
|
||||||
- success
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- pull_request
|
|
||||||
- push
|
|
||||||
ref:
|
|
||||||
exclude:
|
|
||||||
- refs/heads/renovate/*
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default_tests_1.7
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build test
|
|
||||||
pull: if-not-exists
|
|
||||||
image: thegeeklab/drone-docker-buildx
|
|
||||||
settings:
|
|
||||||
dockerfile: 1.7/Dockerfile
|
|
||||||
dry_run: true
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_password_ro
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
repo: mwalbeck/getgrav
|
|
||||||
username:
|
|
||||||
from_secret: dockerhub_username
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default_tests_1.7-prod
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build test
|
|
||||||
pull: if-not-exists
|
|
||||||
image: thegeeklab/drone-docker-buildx
|
|
||||||
settings:
|
|
||||||
dockerfile: 1.7/Dockerfile.prod
|
|
||||||
dry_run: true
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_password_ro
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
repo: mwalbeck/getgrav
|
|
||||||
username:
|
|
||||||
from_secret: dockerhub_username
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: release_1.7
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: determine tags
|
|
||||||
pull: if-not-exists
|
|
||||||
image: mwalbeck/determine-docker-tags
|
|
||||||
environment:
|
|
||||||
APP_NAME: GRAV
|
|
||||||
CUSTOM_TAGS: latest
|
|
||||||
DOCKERFILE_PATH: 1.7/Dockerfile
|
|
||||||
INCLUDE_MAJOR: negative
|
|
||||||
VERSION_TYPE: docker_env
|
|
||||||
|
|
||||||
- name: build and publish
|
|
||||||
pull: if-not-exists
|
|
||||||
image: thegeeklab/drone-docker-buildx
|
|
||||||
settings:
|
|
||||||
dockerfile: 1.7/Dockerfile
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_password
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
repo: mwalbeck/getgrav
|
|
||||||
username:
|
|
||||||
from_secret: dockerhub_username
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: release_1.7-prod
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: determine tags
|
|
||||||
pull: if-not-exists
|
|
||||||
image: mwalbeck/determine-docker-tags
|
|
||||||
environment:
|
|
||||||
APP_ENV: prod
|
|
||||||
APP_NAME: GRAV
|
|
||||||
CUSTOM_TAGS: latest-prod
|
|
||||||
DOCKERFILE_PATH: 1.7/Dockerfile.prod
|
|
||||||
INCLUDE_MAJOR: negative
|
|
||||||
VERSION_TYPE: docker_env
|
|
||||||
|
|
||||||
- name: build and publish
|
|
||||||
pull: if-not-exists
|
|
||||||
image: thegeeklab/drone-docker-buildx
|
|
||||||
settings:
|
|
||||||
dockerfile: 1.7/Dockerfile.prod
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_password
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
repo: mwalbeck/getgrav
|
|
||||||
username:
|
|
||||||
from_secret: dockerhub_username
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: signature
|
|
||||||
hmac: 510995e2c823c0fc6e76df59b2290f27b58094f9bb28c3ec98735202f0246b5f
|
|
||||||
|
|
||||||
...
|
|
91
.forgejo/workflows/build.yml
Normal file
91
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
name: Build and publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
if: github.ref != 'refs/heads/renovate/*'
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: https://github.com/hadolint/hadolint-action@v3.1.0
|
||||||
|
with:
|
||||||
|
dockerfile: ./1.7/Dockerfile
|
||||||
|
- uses: https://github.com/hadolint/hadolint-action@v3.1.0
|
||||||
|
with:
|
||||||
|
dockerfile: ./1.7/Dockerfile.prod
|
||||||
|
- uses: https://github.com/ludeeus/action-shellcheck@2.0.0
|
||||||
|
|
||||||
|
grav1_7:
|
||||||
|
runs-on: dind
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Get docker tags
|
||||||
|
id: tags
|
||||||
|
shell: sh
|
||||||
|
env:
|
||||||
|
VERSION_TYPE: "docker_env"
|
||||||
|
APP_NAME: "GRAV"
|
||||||
|
DOCKERFILE_PATH: "1.7/Dockerfile"
|
||||||
|
INCLUDE_MAJOR: "no"
|
||||||
|
CUSTOM_TAGS: "latest"
|
||||||
|
IMAGE_NAME: "mwalbeck/composer"
|
||||||
|
run: |
|
||||||
|
determine-docker-tags
|
||||||
|
dockerd &
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: https://github.com/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
- name: Build and push
|
||||||
|
uses: https://github.com/docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.tags.outputs.tags }}
|
||||||
|
context: ./1.7
|
||||||
|
file: Dockerfile
|
||||||
|
|
||||||
|
grav1_7_prod:
|
||||||
|
runs-on: dind
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Get docker tags
|
||||||
|
id: tags
|
||||||
|
shell: sh
|
||||||
|
env:
|
||||||
|
VERSION_TYPE: "docker_env"
|
||||||
|
APP_NAME: "GRAV"
|
||||||
|
APP_ENV: "prod"
|
||||||
|
DOCKERFILE_PATH: "1.7/Dockerfile.prod"
|
||||||
|
INCLUDE_MAJOR: "no"
|
||||||
|
CUSTOM_TAGS: "latest-prod"
|
||||||
|
IMAGE_NAME: "mwalbeck/composer"
|
||||||
|
run: |
|
||||||
|
determine-docker-tags
|
||||||
|
dockerd &
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: https://github.com/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
- name: Build and push
|
||||||
|
uses: https://github.com/docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.tags.outputs.tags }}
|
||||||
|
context: ./1.7
|
||||||
|
file: Dockerfile.prod
|
78
.forgejo/workflows/test.yml
Normal file
78
.forgejo/workflows/test.yml
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
if: github.ref != 'refs/heads/renovate/*'
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: https://github.com/hadolint/hadolint-action@v3.1.0
|
||||||
|
with:
|
||||||
|
dockerfile: ./1.7/Dockerfile
|
||||||
|
- uses: https://github.com/hadolint/hadolint-action@v3.1.0
|
||||||
|
with:
|
||||||
|
dockerfile: ./1.7/Dockerfile.prod
|
||||||
|
- uses: https://github.com/ludeeus/action-shellcheck@2.0.0
|
||||||
|
|
||||||
|
grav1_7:
|
||||||
|
runs-on: dind
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Get docker tags
|
||||||
|
id: tags
|
||||||
|
shell: sh
|
||||||
|
env:
|
||||||
|
VERSION_TYPE: "docker_env"
|
||||||
|
APP_NAME: "GRAV"
|
||||||
|
DOCKERFILE_PATH: "1.7/Dockerfile"
|
||||||
|
INCLUDE_MAJOR: "no"
|
||||||
|
CUSTOM_TAGS: "latest"
|
||||||
|
IMAGE_NAME: "mwalbeck/composer"
|
||||||
|
run: |
|
||||||
|
determine-docker-tags
|
||||||
|
dockerd &
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
image: tonistiigi/binfmt:qemu-v7.0.0-28
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
- name: Test build
|
||||||
|
uses: https://github.com/docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
tags: ${{ steps.tags.outputs.tags }}
|
||||||
|
file: ./1.7/Dockerfile
|
||||||
|
|
||||||
|
grav1_7_prod:
|
||||||
|
runs-on: dind
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Get docker tags
|
||||||
|
id: tags
|
||||||
|
shell: sh
|
||||||
|
env:
|
||||||
|
VERSION_TYPE: "docker_env"
|
||||||
|
APP_NAME: "GRAV"
|
||||||
|
APP_ENV: "prod"
|
||||||
|
DOCKERFILE_PATH: "1.7/Dockerfile.prod"
|
||||||
|
INCLUDE_MAJOR: "no"
|
||||||
|
CUSTOM_TAGS: "latest-prod"
|
||||||
|
IMAGE_NAME: "mwalbeck/composer"
|
||||||
|
run: |
|
||||||
|
determine-docker-tags
|
||||||
|
dockerd &
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
image: tonistiigi/binfmt:qemu-v7.0.0-28
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
- name: Test build
|
||||||
|
uses: https://github.com/docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
tags: ${{ steps.tags.outputs.tags }}
|
||||||
|
file: ./1.7/Dockerfile.prod
|
|
@ -13,6 +13,7 @@ RUN groupadd --system foo; \
|
||||||
useradd --no-log-init --system --gid foo --create-home foo; \
|
useradd --no-log-init --system --gid foo --create-home foo; \
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
apt-get --reinstall install libc-bin; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
git \
|
git \
|
||||||
unzip \
|
unzip \
|
||||||
|
|
|
@ -13,6 +13,7 @@ RUN groupadd --force --system --gid 33 www-data; \
|
||||||
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
|
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
apt-get --reinstall install libc-bin; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
git \
|
git \
|
||||||
unzip \
|
unzip \
|
||||||
|
|
Loading…
Reference in a new issue