-
Notifications
You must be signed in to change notification settings - Fork 583
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
Add note to sanitize tags #426
Conversation
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Just a note - and maybe I was doing it wrong somehow - but this didn't actually work for me. I kept getting: I ended up using:
and referencing as : |
@PromoFaux Looking at your workflow, I suggest to use the metadata action which will automatically sanitize tags: name: Docker
on:
push:
branches: main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2.1.6
with:
path: /tmp/.docker-buildx-cache
key: ${{ runner.os }}-docker-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-docker-buildx-
- name: Login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
tags: |
sha_${{ github.sha }}
latest
- name: Build
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.docker-buildx-cache
cache-to: type=local,dest=/tmp/.docker-buildx-cache |
Thanks for the tips, I'll take a look! |
And yes indeed there is an issue with the syntax. It should be: |
AH. I came really close to that solution myself! Rather I tried |
Also, yeah, metadata action works well! I am already using it over on pi-hole/docker-pi-hole - I don't know why I didn't use it in this case. |
Yeah you can do a bunch of thing with the metadata-action. For example you could merge both nightly and release workflows and the metadata action will take care of tagging properly based on scheduled events, git tag and so on. |
Closes #424
Signed-off-by: CrazyMax crazy-max@users.noreply.github.com