I'm using github action to build&push docker image, but it failed with err.
buildx failed with: ERROR: invalid tag "***/e2bdy:": invalid reference format
Is there anything wrong with my action.yml ? Local build is successful.
name: e2bdy docker
on:
workflow_dispatch:
push:
branches:
- main
paths:
- version.py
- .github/workflows/build.yml
- requirements.txt
- dockerfile
jobs:
build:
runs-on: ubuntu-latest
name: Build Docker Image
steps:
- name: Checkout
uses: actions/checkout@main
- name: Release version
id: release_version
run: |
app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
echo "app_version=$app_version" >> $GITHUB_ENV
- name: Set Up QEMU
uses: docker/setup-qemu-action@v1
- name: Set Up Buildx
uses: docker/setup-buildx-action@v1
- name: Login DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Image
uses: docker/build-push-action@v2
with:
context: docker
file: dockerfile
build-args: |
GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }}
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
musnows/e2bdy:latest
musnows/e2bdy:${{ env.app_version }}
dockerfile
FROM python:3.11.2
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
ENV LANG="C.UTF-8" \
TZ="Asia/Shanghai" \
PGID=0 \
PUID=0 \
BDY_SECRET_KEY="" \
BDY_APP_KEY="" \
BDY_APP_NAME="e2bdy" \
ENCRYPT_UPLOAD=1 \
SYNC_INTERVAL=600
WORKDIR /app
COPY . /app/
COPY ./config /app/config
VOLUME [ "/app/config" ]
CMD [ "python","main.py" ]
github repo:https://github.com/musnows/encrypt2bdy/tree/main
At first,I used ${{ secrets.DOCKER_USERNAME }}/e2bdy:latest for image name, it failed with this err.So I tryed to use my username instead of action secrets,but it still failed in build docker image
this yaml works
The old one fiailed because I didn't set version.py correctly
Now I'm using this yaml,which cloud push docker images with latest & version in
version.py