Build, push, and publish Docker images #55
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 }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- | |
name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Build, test and push | |
env: | |
IMAGE_ID: "${{ steps.login-ecr.outputs.registry }}/go-ipfs-debug" | |
run: | | |
docker buildx build -o type=docker . --file Dockerfile \ | |
--tag go-ipfs-daemon \ | |
--tag $IMAGE_ID:${{ github.sha }} | |
docker run go-ipfs-daemon dag stat /ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn || exit 1 | |
docker push --all-tags $IMAGE_ID |