From 772dc12024e51a26c1cbdee3180e639aea907694 Mon Sep 17 00:00:00 2001 From: Kyle Michel Date: Thu, 29 Aug 2024 11:59:52 -0400 Subject: [PATCH] Initial version --- .github/workflows/docker-publish.yml | 60 ++++++++++++++++++++++++++++ .gitignore | 1 + Dockerfile | 5 +++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/docker-publish.yml create mode 100644 .gitignore create mode 100644 Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..14e44db --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,60 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + push: + tags: [ 'v*.*' ] + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository_owner }}/rolesanywhere-credential-helper + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=match,pattern=v(\d+.\d+),group=1 + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85e7c1d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8412bdf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM public.ecr.aws/aws-cli/aws-cli:2.17.20 +WORKDIR /usr/local/bin +RUN curl -O https://rolesanywhere.amazonaws.com/releases/1.2.0/X86_64/Linux/aws_signing_helper +RUN chmod a+x aws_signing_helper +USER 1000