Migrate CI
This commit is contained in:
parent
dec8e3626a
commit
5aadb5eb3e
2 changed files with 31 additions and 25 deletions
31
.forgejo/workflows/docker.yaml
Normal file
31
.forgejo/workflows/docker.yaml
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Build release
|
||||
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
DOCKER_REPOSITORY: "git.flifloo.fr"
|
||||
DOCKER_TAG: "$DOCKER_REPOSITORY/$GITHUB_REPOSITORY:latest"
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: docker
|
||||
using: docker:stable
|
||||
|
||||
services:
|
||||
dind:
|
||||
image: docker:stable-dind
|
||||
options: "--privileged"
|
||||
cmd: [ "dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false" ]
|
||||
|
||||
steps:
|
||||
- if: login
|
||||
run: "docker login -u $GITHUB_REPOSITORY_OWNER -p $GITHUB_TOKEN $DOCKER_REPOSITORY"
|
||||
|
||||
- id: build
|
||||
run: "docker buildx build --platform linux/amd64 -t $DOCKER_TAG ."
|
||||
|
||||
- id: push
|
||||
run: "docker push $DOCKER_TAG"
|
||||
|
||||
release:
|
||||
runs-on: docker
|
|
@ -1,25 +0,0 @@
|
|||
docker-build:
|
||||
image: docker:latest
|
||||
stage: build
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
# Default branch leaves tag empty (= latest tag)
|
||||
# All other branches are tagged with the escaped branch name (commit ref slug)
|
||||
script:
|
||||
- |
|
||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||
tag=""
|
||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||
else
|
||||
tag=":$CI_COMMIT_REF_SLUG"
|
||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||
fi
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
||||
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
||||
# Run this job in a branch where a Dockerfile exists
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
exists:
|
||||
- Dockerfile
|
Loading…
Reference in a new issue