diff --git a/.github/workflows/docker-image-build-pull-request.yml b/.github/workflows/docker-image-build-pull-request.yml deleted file mode 100644 index 12b6508..0000000 --- a/.github/workflows/docker-image-build-pull-request.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Build Docker Image on Pull Request -on: - pull_request: - branches: [ "main" ] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag ghcr.io/think-cube/dockerh2t:latest diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 8961cea..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Docker -on: - push: - tags: [ 'v*.*.*' ] -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 - - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 102339e..21efb68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13.0b4-slim +FROM python:3.13.2-slim WORKDIR /app COPY app/ . RUN pip install -r requirements.txt diff --git a/LICENSE b/LICENSE index b6afbd7..ab908cf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Maciej Michalski +Copyright (c) 2025 ThinkCube Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/pipelines/azure-pipelines.yaml b/pipelines/azure-pipelines.yaml new file mode 100644 index 0000000..824eae8 --- /dev/null +++ b/pipelines/azure-pipelines.yaml @@ -0,0 +1,74 @@ + +name: $(date:yyyyMMdd)-$(rev:.r) + +parameters: +- name: publish_docker + displayName: 'Publish Docker Container ???' + type: string + default: 'false' + values: + - true + - false + +trigger: + branches: + include: + - refs/heads/master + - refs/heads/main + +resources: + repositories: + - repository: self + +variables: + - group: GITHUB-PAT-TOKEN + - name: PUBLISH_DOCKER + value: ${{parameters.publish_docker}} + - name: VM_IMAGE + value: ubuntu-latest + - name: IMAGE_NAME + value: "think-cube/dockerh2t" + +pool: + vmImage: $(VM_IMAGE) + +stages: +- stage: TestBuild + condition: eq('${{parameters.publish_docker}}', 'false') + displayName: "Build Docker Image" + jobs: + - job: Build + steps: + - script: echo "##vso[task.setvariable variable=IMAGE_TAG]$(date +%Y%m%d)" + displayName: "Set IMAGE_TAG variable" + + - task: Docker@2 + inputs: + repository: '$(IMAGE_NAME)' + command: 'build' + Dockerfile: 'docker/Dockerfile' + tags: '$(IMAGE_TAG)' + +- stage: BuildAndPush + condition: eq('${{parameters.publish_docker}}', 'true') + displayName: "Push Docker Image" + jobs: + - job: Push + steps: + - checkout: self + - script: echo "##vso[task.setvariable variable=IMAGE_TAG]$(date +%Y%m%d)" + displayName: "Set IMAGE_TAG variable" + - task: Docker@2 + inputs: + command: 'login' + containerRegistry: 'ghcr.io' + username: '$(USERNAME)' + password: '$(TOKEN-FOR-GHCR)' + + - task: Docker@2 + inputs: + containerRegistry: 'ghcr.io' + repository: '$(IMAGE_NAME)' + command: 'buildAndPush' + Dockerfile: 'docker/Dockerfile' + tags: '$(IMAGE_TAG)'