Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Heroku docker build #2

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy and Build Docker Image and release to Heroku

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag ngx-ramblers:latest
- name: Tag the Docker image
run: docker tag ngx-ramblers:latest ${{ secrets.DOCKER_USERNAME }}/ngx-ramblers:latest
- name: Push the Docker image to Docker Hub
run: docker push ${{ secrets.DOCKER_USERNAME }}/ngx-ramblers:latest
- name: Install Heroku CLI
run: |
curl https://cli-assets.heroku.com/install.sh | sh
- name: Log in to Heroku container registry
run: |
echo "${{ secrets.HEROKU_API_KEY }}" | docker login --username="${{ secrets.HEROKU_EMAIL }}" --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/latest
- name: Push Docker image to Heroku
run: |
docker push registry.heroku.com/ngx-ramblers-docker/latest
- name: Release Docker image on Heroku
run: |
heroku container:release latest --app ngx-ramblers-docker
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Build and Deploy NGX-Ramblers Docker Image

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
Expand Down
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
Loading