Build, push, and publish Docker images #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: Deprecated | |
name: Build, push, and publish Docker images | |
on: | |
# push: | |
# branches: [ develop, release-candidate, main ] | |
# paths-ignore: | |
# - '.github/**' | |
# - 'README.md' | |
workflow_dispatch: # manually triggered | |
jobs: | |
build_and_push: | |
name: Build image and push to repositories | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check out the repo | |
uses: actions/checkout@v2 | |
- | |
name: Set branch name | |
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# Can only use us-east-1 for public repos | |
aws-region: us-east-1 | |
- | |
name: Login to Amazon ECR | |
id: login-ecr-public | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
mask-password: 'true' | |
registry-type: public | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Build, test and push | |
env: | |
IMAGE_ID: "${{ steps.login-ecr-public.outputs.registry }}/r5b3e0r5/3box/kubo" | |
run: | | |
docker buildx build -o type=docker . --file Dockerfile \ | |
--tag go-ipfs-daemon \ | |
--tag $IMAGE_ID:latest \ | |
--tag $IMAGE_ID:${{ github.sha }} | |
docker run go-ipfs-daemon dag stat /ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn || exit 1 | |
docker push --all-tags $IMAGE_ID |