diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 00000000..fb8d7257 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,46 @@ +name: Build Docker image +on: + workflow_dispatch: + push: + tags: + - '*' + branches: + - main + - master + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log into the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push the Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: src/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 26ee418c..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -stages: - - unit-test - - build-staging - - build-release - - unit-test -image: docker:stable -variables: - DOCKER_DRIVER: overlay2 - DOCKER_TLS_CERTDIR: "" # HOTFIX? - ANSIBLE_HOST_KEY_CHECKING: 'false' - ANSIBLE_FORCE_COLOR: 'true' - -services: - - docker:dind - -build-staging: - stage: build-staging - script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com - - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -f ./src/Dockerfile . - - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME - rules: - - if: '$CI_COMMIT_REF_NAME == "main" && $CI_PIPELINE_SOURCE != "merge_request_event"' -build-release: - stage: build-release - script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com - - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -f ./src/Dockerfile . - - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME - only: - - tags - -test: - image: "mcr.microsoft.com/dotnet/sdk:6.0" - stage: unit-test - variables: - test_path: "$project/test/$project.Tests" - script: - - cd test/FundsManager.Tests - - dotnet test -