heroku-deploy icon indicating copy to clipboard operation
heroku-deploy copied to clipboard

Problems using it with Dockerfile

Open imgios opened this issue 4 years ago • 4 comments

I've been running the workflow for about 1h or so (and it's still running) but the action doesn't start/end.

This is the workflow:

name: Deploy in Production

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: akhileshns/[email protected]
        with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: "nonnatittina-bot"
          heroku_email: ${{secrets.HEROKU_EMAIL}}
          usedocker: true
          docker_build_args: TG_BOT_TOKEN
        env:
          TG_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}

And this is the Dockerfile:

FROM python:3

ARG TG_BOT_TOKEN

ENV TELEGRAM_BOT_TOKEN=$TG_BOT_TOKEN
WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

RUN python bot.py

CMD ["python", "./bot.py"]

Manually deploy from the Heroku Dashboard (attaching the app with the repository) works. Am I doing something wrong?

imgios avatar Oct 13 '21 14:10 imgios

After 6hrs I cancelled the workflow and this is the output obtained:

Run akhileshns/[email protected]
Created and wrote to ~/.netrc
 ›   Warning: Our terms of service have changed: 
Successfully logged into heroku
 ›   https://dashboard.heroku.com/terms-of-service
WARNING! Your password will be stored unencrypted in /home/runner/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Added git remote heroku

            Unable to push branch because the branch is behind the deployed branch. Using --force to deploy branch. 
            (If you want to avoid this, set dontuseforce to 1 in with: of .github/workflows/action.yml. 
            Specifically, the error was: Error: spawnSync /bin/sh ENOBUFS
        
Error: The operation was canceled.

imgios avatar Oct 13 '21 20:10 imgios

I had the same issue 🐛

guiferpa avatar Jun 11 '22 04:06 guiferpa

@imgios take a look. I hope that's help you. That works for me

.github/workflows/heroku-deploy.yaml

name: Deploy Heroku
  
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: akhileshns/[email protected]
        with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}} # Put here the owner heroku account API Key
          heroku_app_name: "" # Don't worry about set this param, this first step's just for login in Heroku
          heroku_email: "<owner-heroku-account-email>"
          team: <your-heroku-team> # Set this if it makes sense on your case
          justlogin: true
      - run: |
          heroku container:login && \
          heroku container:push web --app <heroku-app-name> && \
          heroku container:release web --app <heroku-app-name>

This workaround was to most elegancy that I could get 😃

guiferpa avatar Jun 20 '22 14:06 guiferpa

Really cool, will test it also in my repository!

Nice one 😎

I think this action is not maintained anymore so I don't know if it makes sense to use it still or not. I must admit that I haven't looked for an alternative yet.

imgios avatar Jun 20 '22 19:06 imgios