diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62d125b..7f6a931 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,12 +18,25 @@ jobs: name: Generation vars runs-on: ubuntu-latest outputs: - prefix-test: ${{ steps.basic.outputs.prefix_test }} + prefix-latest: ${{ steps.basic.outputs.last_tag }} steps: + - name: Get version + id: _tmp_last_tag + env: + DOCKERHUB_REPO: ... + DOCKERHUB_IMAGE: ... + run: | + version=$(curl -L --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=1000" | \ + jq '.results | .[] | .name' -r | \ + sed 's/latest//' | \ + sort --version-sort | \ + tail -n 1) + echo "value=$version" >> $GITHUB_OUTPUT - name: Create basic vars id: basic run: | - echo "prefix_test=test" >> $GITHUB_OUTPUT + echo "last_tag=${{ steps._tmp_last_tag.outputs.value }}" >> $GITHUB_OUTPUT + lint-dockerfile: needs: [ vars ] @@ -59,20 +72,22 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Set test prefix - id: tag + - name: Create image tag + id: image_tag run: | - echo "test=${{ secrets.DOCKER_USERNAME }}/${{ vars.APP_NAME }}:${{ needs.vars.outputs.prefix-test }}" >> $GITHUB_OUTPUT + echo "value=${{ secrets.DOCKER_USERNAME }}/${{ vars.APP_NAME }}:${{ needs.vars.outputs.prefix-latest }}" >> "$GITHUB_OUTPUT" - - name: Build docker image + - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64 file: Dockerfile - load: true + push: true provenance: false target: local tags: | - ${{ steps.tag.outputs.test }} + ${{ steps.image_tag.outputs.value }} + cache-from: type=gha cache-to: type=gha,mode=max + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1cbf956 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.9" + +services: + app: + build: + dockerfile: Dockerfile + context: . + args: + BASE_IMAGE: textadi/aws-kubectl:2.15.35-1.29.3 + environment: + DEBUG: true + NAMESPACE_NAME: "default" + AWS_ACCOUNT: "test" + ECR_TOKEN: "test" + AWS_ACCESS_KEY_ID: "test" + AWS_SECRET_ACCESS_KEY: "test" + + tty: true \ No newline at end of file