storing docker images - v3 #39
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
--- | |
name: Workflow | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
packages: write | |
statuses: write | |
concurrency: | |
group: | | |
'${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
# testing-image: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# - name: Log in to the Container registry | |
# uses: docker/login-action@5139682d94efc37792e6b54386b5b470a68a4737 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Docker Meta | |
# id: meta | |
# uses: docker/metadata-action@v5 | |
# with: | |
# images: | | |
# ghcr.io/${{ github.repository }} | |
# - name: Build and push | |
# uses: docker/build-push-action@v5 | |
# with: | |
# context: . | |
# file: testing.Dockerfile | |
# platforms: linux/amd64 | |
# labels: ${{ steps.meta.outputs.labels }} | |
# push: true | |
# tags: ghcr.io/${{ github.repository }}:testing-${{ github.sha }} | |
# cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:testing-buildcache | |
# cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:testing-buildcache,mode=max | |
testing: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section | |
with: | |
aws-region: us-east-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
# - name: Build, tag, and push docker image to Amazon ECR | |
# env: | |
# REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
# REPOSITORY: k3auto | |
# IMAGE_TAG: testing-${{ github.sha }} | |
# run: | | |
# docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . | |
# docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPOSITORY: k3auto | |
IMAGE_TAG: testing-${{ github.sha }} | |
with: | |
context: . | |
file: testing.Dockerfile | |
platforms: linux/amd64 | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true | |
tags: $REGISTRY/$REPOSITORY:$IMAGE_TAG | |
cache-from: type=registry,ref=$REGISTRY/$REPOSITORY:$IMAGE_TAG-buildcache | |
cache-to: type=registry,ref=$REGISTRY/$REPOSITORY:$IMAGE_TAG-buildcache,mode=max | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
cache: false | |
- name: Containers | |
run: "docker ps -a" | |
shell: bash | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
- name: Task Test | |
run: "task docker-test" |