From 1c486b40cc7d799e5786d84d6ded809b69a2ce76 Mon Sep 17 00:00:00 2001 From: Valeriy Manzhos <47538801+InvisibleRain@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:21:12 +0300 Subject: [PATCH] chore(docker): Publish docker images on Github Container Registry (#1425) * Temporary test * Push containers to ghcr.io via GitHub Actions * replace tabs with spaces * temporary comment out dockerhub * temporary comment out dockerhub for gui * revertme: remove non-ghcr docker image tags * convert repo owner name to lowercase * fix conversion to lowercase * fix typo, move lowercase conversion to calculate sooner * copy lowercase conversion to both jobs * fix typo * add labels to gui and dev Dockerfiles * specify correct push path for the ghcr.io * fix typo * hardcode image name * specify correct labels for upstream * add dockerhub tags * uncomment dockerhub login * restore Dockerfile.dev --- .github/workflows/release_main.yml | 24 +++++++++++++++++++++++- Dockerfile | 1 + Dockerfile.gui | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 9406765d..5d72cabe 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -760,11 +760,20 @@ jobs: uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Login to GitHub container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Convert repository owner to lowercase + run: | + echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV} - name: Build and push uses: docker/build-push-action@v5.0.0 with: @@ -776,6 +785,8 @@ jobs: tags: | ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.tag }} ${{ steps.prep.outputs.image }}:latest + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:${{ steps.prep.outputs.tag }} + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:latest cache-from: type=gha cache-to: type=gha,mode=max Release_v2rayA_GUI_to_Docker: @@ -805,11 +816,20 @@ jobs: uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Login to GitHub container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Convert repository owner to lowercase + run: | + echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV} - name: Build and push uses: docker/build-push-action@v5.0.0 with: @@ -818,7 +838,9 @@ jobs: file: install/docker/Dockerfile.GUI.Action platforms: linux/arm,linux/arm64,linux/amd64 push: true - tags: mzz2017/v2raya-gui:latest + tags: | + mzz2017/v2raya-gui:latest + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya-gui:latest cache-from: type=gha cache-to: type=gha,mode=max Submit_to_Microsoft_winget: diff --git a/Dockerfile b/Dockerfile index 9bda9440..a15da0d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ FROM v2fly/v2fly-core COPY --from=builder /build/service/v2raya /usr/bin/ RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat RUN apk add --no-cache iptables ip6tables tzdata +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 2017 VOLUME /etc/v2raya ENTRYPOINT ["v2raya"] diff --git a/Dockerfile.gui b/Dockerfile.gui index 1a493969..441e74ed 100644 --- a/Dockerfile.gui +++ b/Dockerfile.gui @@ -5,4 +5,5 @@ RUN yarn && yarn build FROM nginx:stable-alpine COPY --from=builder /web /usr/share/nginx/html +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 80