14 Commits

Author SHA1 Message Date
e62b953a1b Update php-fpm config
All checks were successful
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
ci/woodpecker/tag/tag Pipeline was successful
2025-05-11 11:45:33 +03:00
eafeffe952 Update phpbb to 3.3.15 2025-05-11 11:35:57 +03:00
d63cd998c6 Fix tag manifest creation
All checks were successful
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
ci/woodpecker/tag/tag Pipeline was successful
2025-01-14 03:47:50 +04:00
35a02be21c Add semver tagging using docker-dind
Some checks failed
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/tag Pipeline failed
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
2025-01-14 03:45:07 +04:00
ae2439998d Update README
All checks were successful
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
2025-01-14 03:07:37 +04:00
ce96e5592a Use Docker buildx to build images
All checks were successful
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
2025-01-14 03:05:02 +04:00
b4b1c47eae Add experimental registry cleanup
All checks were successful
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
2025-01-14 02:57:33 +04:00
c822b2a1f9 Pass forgotten variable
All checks were successful
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline was successful
2025-01-14 02:38:05 +04:00
af875287ed Fix Docker login for tagging
Some checks failed
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline failed
2025-01-14 02:36:37 +04:00
2409844953 Fix Docker tag name
Some checks failed
ci/woodpecker/push/build/2 Pipeline was successful
ci/woodpecker/push/build/1 Pipeline was successful
ci/woodpecker/push/tag Pipeline failed
2025-01-14 02:34:33 +04:00
5aa1e4efcb Try to build :latest using docker-dind
Some checks failed
ci/woodpecker/push/build/2 Pipeline failed
ci/woodpecker/push/build/1 Pipeline failed
ci/woodpecker/push/tag unknown status
2025-01-14 02:32:01 +04:00
c3013e3944 Try to remove platform tag from builds
All checks were successful
ci/woodpecker/push/docker/2 Pipeline was successful
ci/woodpecker/push/docker/1 Pipeline was successful
2025-01-14 01:49:25 +04:00
0df2a638b4 Add ability to build image using multiple runners (!1)
All checks were successful
ci/woodpecker/push/docker/2 Pipeline was successful
ci/woodpecker/push/docker/1 Pipeline was successful
Reviewed-on: #1
2025-01-13 17:37:19 +04:00
5071b3131d Pass REMOTE_ADDR from upstream proxy
Some checks failed
ci/woodpecker/tag/docker Pipeline was successful
ci/woodpecker/push/docker Pipeline failed
2025-01-08 21:23:05 +04:00
11 changed files with 380 additions and 43 deletions

35
.woodpecker/build.yaml Normal file
View File

@@ -0,0 +1,35 @@
matrix:
platform:
- linux/amd64
- linux/arm64
labels:
platform: ${platform}
when:
branch: main
event: [push, pull_request, tag]
steps:
test-build:
image: docker:27-dind
commands:
- docker buildx build -t source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-${platform##linux/} .
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: pull_request
build-to-registry:
image: docker:27-dind
environment:
CI_USER_PASSWORD:
from_secret: registry_token
commands:
- docker login -u ${CI_REPO_OWNER} -p $${CI_USER_PASSWORD} source.hodakov.me
- docker buildx build -t source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-${platform##linux/} .
- docker push source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-${platform##linux/}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: [push, tag]

View File

@@ -1,35 +0,0 @@
when:
branch: main
event: [push, pull_request, tag]
variables:
- &repo source.hodakov.me/${CI_REPO_OWNER}/phpbb
steps:
dryrun:
image: woodpeckerci/plugin-docker-buildx:5.1.0
privileged: true
settings:
dockerfile: Dockerfile
platforms: linux/arm64/v8,linux/amd64
dry_run: true
repo: *repo
auto_tag: true
when:
event: pull_request
publish:
image: woodpeckerci/plugin-docker-buildx:5.1.0
privileged: true
settings:
dockerfile: Dockerfile
platforms: linux/arm64/v8,linux/amd64
repo: *repo
registry: source.hodakov.me
auto_tag: true
username: ${CI_REPO_OWNER}
password:
from_secret: registry_token
when:
event: [push, tag]

46
.woodpecker/tag.yaml Normal file
View File

@@ -0,0 +1,46 @@
when:
branch: main
event: [push, tag]
depends_on:
- build
steps:
tag latest:
image: docker:27-dind
environment:
CI_USER_PASSWORD:
from_secret: registry_token
commands:
- docker login -u ${CI_REPO_OWNER} -p $${CI_USER_PASSWORD} source.hodakov.me
- docker pull source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64
- docker pull source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
- docker manifest create source.hodakov.me/hdkv/phpbb:latest source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64 source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
- docker manifest push source.hodakov.me/hdkv/phpbb:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: push
tag semver:
image: docker:27-dind
environment:
CI_USER_PASSWORD:
from_secret: registry_token
commands:
- set -eu
- docker login -u ${CI_REPO_OWNER} -p $${CI_USER_PASSWORD} source.hodakov.me
- source ./scripts/semver.sh
- echo "Creating manifest for $${DOCKER_EXACT_TAG}, $${DOCKER_MAJOR_TAG} and $${DOCKER_MINOR_TAG}"
- docker pull source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64
- docker pull source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
- docker manifest create source.hodakov.me/hdkv/phpbb:$${DOCKER_EXACT_TAG} source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64 source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
- docker manifest create source.hodakov.me/hdkv/phpbb:$${DOCKER_MINOR_TAG} source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64 source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
- docker manifest create source.hodakov.me/hdkv/phpbb:$${DOCKER_MAJOR_TAG} source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64 source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
- docker manifest push source.hodakov.me/hdkv/phpbb:$${DOCKER_EXACT_TAG}
- docker manifest push source.hodakov.me/hdkv/phpbb:$${DOCKER_MINOR_TAG}
- docker manifest push source.hodakov.me/hdkv/phpbb:$${DOCKER_MAJOR_TAG}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: tag

View File

@@ -55,8 +55,8 @@ RUN mkdir /.config /phpbb
COPY src/ /var/www/html/
# Add phpBB installation
ENV PHPBB_VERSION=3.3.14
ENV PHPBB_SHA256=68cd6cf3faefa175ea3892ba02c6b112e8967ed33703521c79820e35bd15ec9a
ENV PHPBB_VERSION=3.3.15
ENV PHPBB_SHA256=b4a1d0b579651dcdd55f02c0b742d23fb5d45f915de60628d5aadd34d32cf761
WORKDIR /tmp

View File

@@ -9,6 +9,9 @@ This is a heavily modified fork of [selim13's docker-phpbb image](https://github
You can find an example of forum running using this image at [ks.fhs.sh](https://ks.fhs.sh).
Note: this image expects that you run it behind another reverse proxy and does _not_ handle HTTPS automatically. Use it
behind another instance of caddy, for example.
# Supported tags and respective `Dockerfile` links
- [`3`,`3.3`, `3.3.14`, `latest`](https://source.hodakov.me/hdkv/docker-phpbb/src/branch/main/Dockerfile) bundled with PHP 8
@@ -172,8 +175,11 @@ If set to `true`, enables phpBB debug mode.
## Volumes
No default volumes are predefined. You can mount everything you want
inside `/phpbb/<something>`. For example, given that [ks.fhs.sh](https://ks.fhs.sh)
was migrating into Docker from bare metal instance back in 2023, I
mounted the directories `files`, `store`, `ext`, `images` and
`themes`, which proved working for more than a year at this point.
There are predefined volumes in the image:
- /phpbb/sqlite
- /phpbb/www/files
- /phpbb/www/store
- /phpbb/www/images/avatars/upload
This list of volumes should be good enough for a forum that starts from scratch.

View File

@@ -10,6 +10,7 @@
php_fastcgi unix//run/php-fpm.sock {
trusted_proxies private_ranges
env REMOTE_ADDR {client_ip}
}
file_server

View File

@@ -30,7 +30,7 @@ pm = ondemand
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 100
pm.max_children = 1024
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'

View File

@@ -0,0 +1,19 @@
module source.hodakov.me/hdkv/docker-phpbb/scripts/registry-cleanup
go 1.23.4
require (
code.gitea.io/sdk/gitea v0.20.0
github.com/carlmjohnson/requests v0.24.3
github.com/davecgh/go-spew v1.1.0
)
require (
github.com/42wim/httpsig v1.2.1 // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/go-fed/httpsig v1.1.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.23.0 // indirect
)

View File

@@ -0,0 +1,40 @@
code.gitea.io/sdk/gitea v0.20.0 h1:Zm/QDwwZK1awoM4AxdjeAQbxolzx2rIP8dDfmKu+KoU=
code.gitea.io/sdk/gitea v0.20.0/go.mod h1:faouBHC/zyx5wLgjmRKR62ydyvMzwWf3QnU0bH7Cw6U=
github.com/42wim/httpsig v1.2.1 h1:oLBxptMe9U4ZmSGtkosT8Dlfg31P3VQnAGq6psXv82Y=
github.com/42wim/httpsig v1.2.1/go.mod h1:P/UYo7ytNBFwc+dg35IubuAUIs8zj5zzFIgUCEl55WY=
github.com/carlmjohnson/requests v0.24.3 h1:LYcM/jVIVPkioigMjEAnBACXl2vb42TVqiC8EYNoaXQ=
github.com/carlmjohnson/requests v0.24.3/go.mod h1:duYA/jDnyZ6f3xbcF5PpZ9N8clgopubP2nK5i6MVMhU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI=
github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -0,0 +1,142 @@
// Picked from https://github.com/go-gitea/gitea/issues/21673#issuecomment-2331964935
package main
import (
"context"
"fmt"
"os"
"slices"
"strings"
"code.gitea.io/sdk/gitea"
"github.com/carlmjohnson/requests"
"github.com/davecgh/go-spew/spew"
)
var (
RegistryURL = os.Getenv("REGISTRY_URL")
GiteaURL = os.Getenv("GITEA_URL")
Token = os.Getenv("REGISTRY_TOKEN")
)
func main() {
if err := run(); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println("OK")
}
func run() error {
ctx := context.TODO()
var catalog RegistryCatalog
if err := requests.URL(RegistryURL).Path("/v2/_catalog").BasicAuth("<token>", Token).ToJSON(&catalog).Fetch(ctx); err != nil {
return err
}
var images []string
var orgs []string
for _, repo := range catalog.Repositories {
srepo := strings.Split(repo, "/")
if len(srepo) == 2 {
if !slices.Contains(orgs, srepo[0]) {
orgs = append(orgs, srepo[0])
}
var regRepo RegistryRepository
if err := requests.URL(RegistryURL).Pathf("/v2/%s/tags/list", repo).BasicAuth("<token>", Token).ToJSON(&regRepo).Fetch(ctx); err != nil {
return err
}
for _, tag := range regRepo.Tags {
var regMan RegistryRepositoryManifest
if err := requests.URL(RegistryURL).Pathf("/v2/%s/manifests/%s", repo, tag).BasicAuth("<token>", Token).ToJSON(&regMan).Fetch(ctx); err != nil {
return err
}
for _, man := range regMan.Manifests {
images = append(images, repo+"/"+man.Digest)
}
}
}
}
var toPurge, toKeep []string
client, err := gitea.NewClient(GiteaURL, gitea.SetToken(Token))
if err != nil {
return err
}
for _, org := range orgs {
page := 1
pageSize := -1
for {
list, _, err := client.ListPackages(org, gitea.ListPackagesOptions{ListOptions: gitea.ListOptions{Page: page}})
if err != nil {
return err
}
if pageSize < 0 {
pageSize = len(list)
}
if len(list) < pageSize || len(list) == 0 {
break
}
page++
for _, pkg := range list {
if pkg.Type == "container" && strings.HasPrefix(pkg.Version, "sha") {
if slices.Contains(images, org+"/"+pkg.Name+"/"+pkg.Version) {
toKeep = append(toKeep, org+"/"+pkg.Name+"/"+pkg.Version)
} else {
toPurge = append(toPurge, org+"/"+pkg.Name+"/"+pkg.Version)
}
}
}
}
}
slices.Sort(images)
slices.Sort(toKeep)
spew.Dump(images)
spew.Dump(toKeep)
spew.Dump(toPurge)
/*
if !slices.Equal(images, toKeep) {
return fmt.Errorf("images from registry don't match with those to keep")
}
*/
for _, p := range toPurge {
px := strings.Split(p, "/")
if len(px) == 3 {
if _, err := client.DeletePackage(px[0], "container", px[1], px[2]); err != nil {
return err
}
}
}
return nil
}
type RegistryCatalog struct {
Repositories []string `json:"repositories"`
}
type RegistryRepository struct {
Name string `json:"name"`
Tags []string `json:"tags"`
}
type RegistryRepositoryManifest struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Digest string `json:"digest"`
Size int `json:"size"`
Manifests []RegistryRepositoryManifest `json:"manifests"`
}

83
scripts/semver.sh Executable file
View File

@@ -0,0 +1,83 @@
#!/bin/bash -eu
# This script prints out git metadata information for a given commit (or head by default)
# It assumes tags of the form `v1.2.3`, and will print prerelease versions when
# not on an exact tag.
#
# It is intended to be used like so:
#
# cd <some-git-repo>
# $(../semver-from-git.sh)
#
# or
#
# $(../semver-from-git.sh <COMMIT_HASH>)
#
# For prerelease, it prints:
#
# export GIT_BRANCH="master"
# export GIT_SEMVER_FROM_TAG="1.0.1-master+3.ge675710"
#
# where GIT_BRANCH is the first branch it finds with the given commit, and the version string is:
# <MAJOR>.<MINOR>.<PATCH>-<BRANCH>+<COMMITS-SINCE-TAG>.<COMMIT_HASH>
#
# When on an exact tag, it prints:
#
# export GIT_BRANCH="master"
# export GIT_EXACT_TAG=v1.0.2
# export GIT_SEMVER_FROM_TAG=1.0.2
#
# When the working tree is dirty, it will also put ".SNAPSHOT.<HOSTNAME>" on the end of the version
# This is useful if someone has deployed something from their local machine.
# (C) Timothy Jones, 2019, released under BSD License 2.0 (3-clause BSD license)
# https://github.com/TimothyJones
if [ -z "${1:-}" ]; then
COMMIT="HEAD"
# Test whether the working tree is dirty or not
if [ -z "$(git status -s)" ]; then
STATUS=""
else
STATUS=".SNAPSHOT.$(hostname -s)"
fi
else
COMMIT="$1"
STATUS="" # When looking at an exact commit, the working tree is irrelevant
fi
DESCRIBE=$(git describe --always --tags "$COMMIT")
VERSION=$(echo "$DESCRIBE" | sed 's/\(.*\)-\(.*\)-g\(.*\)/\1+\2.\3/' | sed 's/v\(.*\)/\1/')
BRANCH=$(git branch --contains "$COMMIT" | grep -e "^\*" | sed 's/^\* //')
echo "export GIT_BRANCH=$BRANCH"
export GIT_BRANCH=$BRANCH
EXACT_TAG=$(git describe --always --exact-match --tags "$COMMIT" 2> /dev/null || true)
if [ ! -z "$EXACT_TAG" ] ; then
echo "export GIT_EXACT_TAG=${EXACT_TAG}"
echo "export GIT_SEMVER_FROM_TAG=$VERSION$STATUS"
export GIT_EXACT_TAG=${EXACT_TAG}
export GIT_SEMVER_FROM_TAG=$VERSION$STATUS
else
# We split up the prefix and suffix so that we don't accidentally
# give sed commands via the branch name
PREFIX="$(echo "$VERSION" | sed 's/\(.*\)\(\+.*\)/\1/')"
SUFFIX="$(echo "$VERSION" | sed 's/\(.*\)\(\+.*\)/\2/')"
if [ -z $(echo "$PREFIX" | grep "-") ]; then
echo "export GIT_SEMVER_FROM_TAG=$PREFIX-$BRANCH""$SUFFIX$STATUS"
export GIT_SEMVER_FROM_TAG=$PREFIX-$BRANCH""$SUFFIX$STATUS
else
echo "export GIT_SEMVER_FROM_TAG=$PREFIX.$BRANCH""$SUFFIX$STATUS"
export GIT_SEMVER_FROM_TAG=$PREFIX.$BRANCH""$SUFFIX$STATUS
fi
fi
### Add docker tags
echo "export DOCKER_EXACT_TAG=${GIT_EXACT_TAG/v}"
export DOCKER_EXACT_TAG=${GIT_EXACT_TAG/v}
echo "export DOCKER_MAJOR_TAG=${DOCKER_EXACT_TAG%.*.*}"
export DOCKER_MAJOR_TAG=${DOCKER_EXACT_TAG%.*.*}
echo "export DOCKER_MINOR_TAG=${DOCKER_EXACT_TAG%.*}"
export DOCKER_MINOR_TAG=${DOCKER_EXACT_TAG%.*}