diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..6bed03b --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,65 @@ +name: CI (main and tags) +on: + push: + branches: [ "main" ] + schedule: + - cron: '0 0 * * 2' +permissions: + checks: write + contents: write + packages: write + pull-requests: read +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }}/build + tags: | + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + dockerfile: Dockerfile.build + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + app: + name: App + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }}/app + tags: | + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + dockerfile: Dockerfile.app + tags: ${{ steps.meta.outputs.tags }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 4f998cd..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -default: - image: docker - services: ['docker:dind'] - before_script: - - apk --no-cache add git -variables: - DOCKER_DRIVER: overlay2 - PLATFORMS: linux/arm64/v8,linux/amd64 - -base/build: - stage: build - script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - docker buildx create --use - - docker buildx build --provenance=false --platform ${PLATFORMS} --pull --push -t ${CI_REGISTRY_IMAGE}/build -f Dockerfile.build . - -base/app: - stage: build - script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - docker buildx create --use - - docker buildx build --provenance=false --platform ${PLATFORMS} --pull --push -t ${CI_REGISTRY_IMAGE}/app -f Dockerfile.app .