-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One dir manage multi images . #346
Comments
@HiColinn Would need logs and a link to your repo. |
In addition to the solution submitted by @CremaLuca (#365 (comment)), here is another using a matrix strategy: name: Build Docker Image
on:
push:
branches:
- master
jobs:
build:
name: Build docker image
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
context:
- alpine-base
- alpine-full
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Filter image name
run: |
...
-
name: Show var
run: |
echo IMAGE_NAME=${{ env.IMAGE_NAME }}
echo IMAGE_RNAME=$IMAGE_RNAME
echo TAG_NAMES=$TAG_NAMES
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
if: ${{ env.IMAGE_NAME != '' }}
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./${{ matrix.context }}
target: prod
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAMES }}
-
name: Push Docker Hub Description
if: ${{ env.IMAGE_RNAME != ''}}
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_RNAME }}
readme-filepath: ${{ env.IMAGE_RNAME }}/README.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Troubleshooting
This is not a BUG issue,but for a help.
I have problem that has bothering me for a long time,I am hoping to get some help!
The problem is I user one directory to manage all docker images,and when I push code to the github,
I will sign the image name(directory) to the git commit message.The build.yml will get the infomation from
the git commit message ,like if need build new image,or push to DockerHub. This way is effective on action V1,but when I update the build.yml to V2,It doesn't work.
The text was updated successfully, but these errors were encountered: