mobility-accounts/.github/workflows/build.yml

161 lines
4.5 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches:
- main
- dev
jobs:
checkout_repository:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Test Gitea
run: |
echo "GITEA_Actor: ${{gitea.actor}}"
echo "GITEA_Repository: ${{gitea.repository}}"
echo "GITEA_Workspace: ${{gitea.workspace}}"
echo "GITEA_SHA: ${{gitea.sha}}"
echo "GITEA_REF: ${{gitea.ref}}"
echo "GITEA_EVENT: ${{gitea.event}}"
echo "GITEA_BASE_REF: ${{gitea.base_ref}}"
# KANIKO
- name: Kaniko build and push
uses: aevea/action-kaniko@master
with:
build_file: Dockerfile
registry: git.coopgo.io
username: ${{gitea.actor}}
password: ${{env.PASSWORD}}
image: coopgo-platform/mobility-accounts
tag: test
cache: true
cache_registry: git.coopgo.io/coopgo-platform/mobility-accounts/cache
extra-args: |
ACCESS_TOKEN_USR=${{gitea.actor}}
ACCESS_TOKEN_PWD=${{env.PASSWORD}}
env:
PASSWORD: 6744954b4a3a43422e62e8d110f90de527ce094d
# BUILDAH
# - name: Install Buildah
# run: |
# apt-get update
# apt-get install -y buildah podman
# export BUILDAH_ISOLATION=chroot
# - name: Buildah Action
# uses: redhat-actions/buildah-build@v2
# id: build-image
# with:
# image: coopgo-platform/mobility-accounts
# tags: test
# containerfiles: |
# ./Dockerfile
# build-args: |
# ACCESS_TOKEN_USR=${{secrets.DOCKER_USERNAME}}
# ACCESS_TOKEN_PWD=${{secrets.DOCKER_PASSWORD}}
# - name: Push To Registry
# id: push-to-registry
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ steps.build-image.outputs.image }}
# tags: ${{ steps.build-image.outputs.tags }}
# registry: git.coopgo.io
# username: ${{secrets.DOCKER_USERNAME}}
# password: ${{secrets.DOCKER_PASSWORD}}
# DOCKER
# - name: Install Docker
# run: |
# apt-get update
# apt-get install -y docker.io
# - name: Login to Docker Registry
# uses: docker/login-action@v2
# with:
# registry: git.coopgo.io
# username: ${{secrets.DOCKER_USERNAME}}
# password: ${{secrets.DOCKER_PASSWORD}}
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Build and Push Docker Image
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: git.coopgo.io/coopgo-platform/mobility-accounts:test
# build-args: |
# ACCESS_TOKEN_USR=${{secrets.DOCKER_USERNAME}}
# ACCESS_TOKEN_PWD=${{secrets.DOCKER_PASSWORD}}
# login_docker_registry:
# runs-on:
# group: ubuntu-latest
# container:
# image: ghcr.io/catthehacker/ubuntu:act-latest
# volumes:
# - /workspace/coopgo-platform/mobility-accounts:/workspace/coopgo-platform/mobility-accounts
# steps:
# - name: Login to Docker Registry
# uses: docker/login-action@v2
# with:
# registry: git.coopgo.io
# username: ${{secrets.DOCKER_USERNAME}}
# password: ${{secrets.DOCKER_PASSWORD}}
# - name: Check folders
# run: |
# pwd
# ls -la
# build_and_push_image:
# runs-on:
# group: ubuntu-latest
# container:
# image: docker:20.10.7
# volumes:
# - /workspace/coopgo-platform/mobility-accounts:/workspace/coopgo-platform/mobility-accounts
# steps:
# # - name: Get Gitea Tags
# # id: get_tags
# # run: |
# # git fetch --tags
# # latest_tag=$(git describe --tags --abbrev=0)
# # echo "Latest tag found: $latest_tag"
# # echo "::set-output name=latest_tag::$latest_tag"
# # - name: Test tags
# # run: |
# # echo "Latest tag found: ${{ steps.get_tags.outputs.latest_tag }}"
# # - name: Check Docker version
# # run: |
# # docker --version
# # dockerd &
# - name: Check folder
# run: |
# pwd
# ls -la
# - name: Build and Push Docker Image
# run: |
# docker build -t git.coopgo.io/coopgo-platform/mobility-accounts:test --build-arg ACCESS_TOKEN_USR=${{secrets.DOCKER_USERNAME}} --build-arg ACCESS_TOKEN_PWD=${{secrets.DOCKER_PASSWORD}} .