Skip to content

Commit

Permalink
Tidy up automated Docker image builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jknipp committed May 1, 2024
1 parent 48911e3 commit 31eb11c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 35 deletions.
71 changes: 36 additions & 35 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
# This is a basic workflow to help you get started with Actions
# WARNIING: Docker builds have been moved to Docker Hub using connected Git Hub credentials.
# An Image is built and pushed to Docker Hub on every push to the main branch.

name: Docker Build and Push
# name: Docker Build and Push

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: [ main ]
# # Controls when the action will run. Triggers the workflow on push or pull request
# # events but only for the main branch
# on:
# push:
# branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# # A workflow run is made up of one or more jobs that can run sequentially or in parallel
# jobs:
# # This workflow contains a single job called "build"
# build:
# # The type of runner that the job will run on
# runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v4
# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - name: Checkout repository
# uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: spreedly/phasers-worksample
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: spreedly/phasers-worksample

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: latest
# - name: Build and push Docker image
# id: push
# uses: docker/build-push-action@v5
# with:
# context: .
# push: true
# tags: latest
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ It uses the [httparty](https://github.com/jnunemaker/httparty) gem.
## Heroku Deployment

Phasers Worksample is deployed to Heroku as a container application. See https://devcenter.heroku.com/articles/container-registry-and-runtime#getting-started for details on this process.

## Docker Hub

Docker image builds are setup in Docker Hub to be built automatically upon pushing changes to GitHub. This requires GitHub to be connected to Docker Hub.

0 comments on commit 31eb11c

Please sign in to comment.