From de02e07264ed4fb33fc8a614111b9a40a4b58177 Mon Sep 17 00:00:00 2001 From: Stefan Werfling Date: Mon, 1 May 2023 22:05:38 +0200 Subject: [PATCH] update workflow, update dockerfiles, add tag latest for build --- .github/workflows/docker-image-release.yml | 39 +++++++++++++++++++--- himhip/Dockerfile | 7 ++++ sshserver/Dockerfile | 7 ++++ 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-image-release.yml b/.github/workflows/docker-image-release.yml index 7a256fb..eef79af 100644 --- a/.github/workflows/docker-image-release.yml +++ b/.github/workflows/docker-image-release.yml @@ -24,23 +24,52 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - + + - name: Gen tags for flyingfish + id: gen_tags_flyingfish + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + TAGS='["${{ secrets.DOCKER_USERNAME }}/flyingfish:latest","${{ secrets.DOCKER_USERNAME }}/flyingfish:'${GITHUB_REF/refs\/tags\//}'"]' + else + TAGS='["${{ secrets.DOCKER_USERNAME }}/flyingfish:latest"]' + fi + echo '::set-output name=tags::'$TAGS + - name: Build and push FlyingFish uses: docker/build-push-action@v2 with: context: . file: ./Dockerfile.nginxsrc push: true - tags: ${{ secrets.DOCKER_USERNAME }}/flyingfish:${{github.ref_name }} - + tags: ${{ fromJson(steps.gen_tags_flyingfish.outputs.tags) }} + + - name: Gen tags for flyingfish ssh + id: gen_tags_flyingfish_ssh + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + TAGS='["${{ secrets.DOCKER_USERNAME }}/flyingfish_ssh:latest","${{ secrets.DOCKER_USERNAME }}/flyingfish_ssh:'${GITHUB_REF/refs\/tags\//}'"]' + else + TAGS='["${{ secrets.DOCKER_USERNAME }}/flyingfish_ssh:latest"]' + fi + echo '::set-output name=tags::'$TAGS + - name: Build and push FlyingFish SSH uses: docker/build-push-action@v2 with: context: ./ file: ./sshserver/Dockerfile push: true - tags: ${{ secrets.DOCKER_USERNAME }}/flyingfish_ssh:${{github.ref_name }} + tags: ${{ fromJson(steps.gen_tags_flyingfish_ssh.outputs.tags) }} + - name: Gen tags for flyingfish himhip + id: gen_tags_flyingfish_himhip + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + TAGS='["${{ secrets.DOCKER_USERNAME }}/flyingfish_himip:latest","${{ secrets.DOCKER_USERNAME }}/flyingfish_himip:'${GITHUB_REF/refs\/tags\//}'"]' + else + TAGS='["${{ secrets.DOCKER_USERNAME }}/flyingfish_himip:latest"]' + fi + echo '::set-output name=tags::'$TAGS - name: Build and push FlyingFish Himhip uses: docker/build-push-action@v2 @@ -48,4 +77,4 @@ jobs: context: ./ file: ./himhip/Dockerfile push: true - tags: ${{ secrets.DOCKER_USERNAME }}/flyingfish_himip:${{github.ref_name }} + tags: ${{ fromJson(steps.gen_tags_flyingfish_himhip.outputs.tags) }} diff --git a/himhip/Dockerfile b/himhip/Dockerfile index dda7b95..5c82802 100644 --- a/himhip/Dockerfile +++ b/himhip/Dockerfile @@ -16,6 +16,13 @@ WORKDIR /opt/core COPY ./core/ ./ +RUN rm -R node_modules | true +RUN rm -R dist | true +RUN rm package-lock.json | true + +RUN npm install +RUN npm run build + # Copy/Install HimHip -------------------------------------------------------------------------------------------------- WORKDIR /opt/app diff --git a/sshserver/Dockerfile b/sshserver/Dockerfile index c2e6ed3..231134f 100644 --- a/sshserver/Dockerfile +++ b/sshserver/Dockerfile @@ -17,6 +17,13 @@ WORKDIR /opt/core COPY ./core/ ./ +RUN rm -R node_modules | true +RUN rm -R dist | true +RUN rm package-lock.json | true + +RUN npm install +RUN npm run build + # Copy/Install sshserver ----------------------------------------------------------------------------------------------- WORKDIR /opt/app