Skip to content

Commit

Permalink
- Added GitHub action for Deploy Docker image to Heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarrett committed Aug 31, 2024
1 parent 6f9ae85 commit add80ab
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Docker image to Heroku

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Log in to Heroku container registry
run: |
echo "${{ secrets.HEROKU_API_KEY }}" | docker login --username= "${{ secrets.DOCKER_USERNAME }}" --password-stdin registry.heroku.com
- name: Pull Docker image from Docker Hub
run: |
docker pull nbarrett36/ngx-ramblers:latest
- name: Tag Docker image for Heroku
run: |
docker tag nbarrett36/ngx-ramblers:latest registry.heroku.com/ngx-ramblers-docker/web
- name: Push Docker image to Heroku
run: |
docker push registry.heroku.com/ngx-ramblers-docker/web
- name: Release Docker image on Heroku
run: |
heroku container:release web --app ngx-ramblers-docker
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
7 changes: 7 additions & 0 deletions heroku-build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# heroku.yml
build:
docker:
web: Dockerfile

run:
web: docker run -d -p $PORT:$PORT nbarrett36/ngx-ramblers:latest

0 comments on commit add80ab

Please sign in to comment.