Skip to content

Commit

Permalink
Merge pull request #10 from rafsaf/Add-docker-build-github-workflows
Browse files Browse the repository at this point in the history
Add manual and auto build workflows
  • Loading branch information
rafsaf authored May 7, 2022
2 parents 7357575 + 2cd4a77 commit 62a5cba
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Push minimal template docker image to dockerhub

on:
workflow_run:
workflows:
- "Run tests"
branches:
- master
types:
- completed

jobs:
push_image_to_dockerhub:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push image
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: ./{{cookiecutter.project_name}}/template_minimal
push: true
tags: rafsaf/minimal-fastapi-postgres-template:latest
29 changes: 29 additions & 0 deletions .github/workflows/manual_build_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Manual push minimal template docker image to dockerhub

on:
workflow_dispatch:
inputs:
tag:
description: "Docker image tag"
required: true
default: "stable"

jobs:
manual_push_image_to_dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push image
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: ./{{cookiecutter.project_name}}/template_minimal
push: true
tags: rafsaf/minimal-fastapi-postgres-template:${{ github.event.inputs.tag }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: Run tests

on:
push:
Expand Down

0 comments on commit 62a5cba

Please sign in to comment.