diff --git a/.gitea/workflows/deploy_staging.yaml b/.gitea/workflows/deploy_staging.yaml index c812e7d..51891a8 100644 --- a/.gitea/workflows/deploy_staging.yaml +++ b/.gitea/workflows/deploy_staging.yaml @@ -70,14 +70,26 @@ jobs: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: Build and Push Docker Image + needs: git-metadata env: IMAGE_NAME: molvaapp/test_deploy CONFIG_FILE: .build/config/staging.yaml run: | - echo "Building image for ${{ inputs.environment }} environment" - echo "Git tag : ${{ steps.git-metadata.outputs.GIT_TAG }}" - echo "Git sha : ${{ steps.git-metadata.outputs.GIT_SHA }}" - echo "Image tag : ${{ steps.git-metadata.outputs.GIT_TAG != 'none' && steps.git-metadata.outputs.GIT_TAG || steps.git-metadata.outputs.GIT_SHA }}" + IMAGE_TAG=${{ inputs.environment }}-${{ steps.git-metadata.outputs.GIT_TAG != 'none' && steps.git-metadata.outputs.GIT_TAG || steps.git-metadata.outputs.GIT_SHA }} + + docker build \ + --build-arg BUILD_LDFLAGS="-w -s" \ + --build-arg CONFIG_FILE_PATH=$CONFIG_FILE \ + -t $IMAGE_NAME:$IMAGE_TAG \ + -t $IMAGE_NAME:latest \ + . + + docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:latest + + docker push $IMAGE_NAME:$IMAGE_TAG + docker push $IMAGE_NAME:latest + + echo "Pushed image $IMAGE_NAME:$IMAGE_TAG and :latest" - name: Install dependencies run: |