Skip to content

Commit 62a5cba

Browse files
authored
Merge pull request #10 from rafsaf/Add-docker-build-github-workflows
Add manual and auto build workflows
2 parents 7357575 + 2cd4a77 commit 62a5cba

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Push minimal template docker image to dockerhub
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- "Run tests"
7+
branches:
8+
- master
9+
types:
10+
- completed
11+
12+
jobs:
13+
push_image_to_dockerhub:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Login to DockerHub
20+
uses: docker/login-action@v1
21+
with:
22+
username: ${{ secrets.DOCKER_USER }}
23+
password: ${{ secrets.DOCKER_PASS }}
24+
25+
- name: Build and push image
26+
uses: docker/build-push-action@v2
27+
with:
28+
file: Dockerfile
29+
context: ./{{cookiecutter.project_name}}/template_minimal
30+
push: true
31+
tags: rafsaf/minimal-fastapi-postgres-template:latest
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Manual push minimal template docker image to dockerhub
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Docker image tag"
8+
required: true
9+
default: "stable"
10+
11+
jobs:
12+
manual_push_image_to_dockerhub:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKER_USER }}
21+
password: ${{ secrets.DOCKER_PASS }}
22+
23+
- name: Build and push image
24+
uses: docker/build-push-action@v2
25+
with:
26+
file: Dockerfile
27+
context: ./{{cookiecutter.project_name}}/template_minimal
28+
push: true
29+
tags: rafsaf/minimal-fastapi-postgres-template:${{ github.event.inputs.tag }}

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Run tests
22

33
on:
44
push:

0 commit comments

Comments
 (0)