adds github action to build and push docker image

This commit is contained in:
Michael Kotten
2022-07-27 16:25:43 +02:00
parent 25a5fbfa9b
commit a55bdb3bcb
2 changed files with 32 additions and 12 deletions
+28 -12
View File
@@ -2,17 +2,33 @@ name: Docker Image CI
on: on:
push: push:
branches: [ "main" ] branches:
pull_request: - main
branches: [ "main" ]
jobs: jobs:
docker:
build: if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
runs-on: python:3-slim
steps: steps:
- uses: actions/checkout@v3 -
- name: Build the Docker image name: Checkout
run: docker build . --file Dockerfile --tag sungather:$(date +%s) uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sungather:latest
+4
View File
@@ -115,3 +115,7 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
# Intellij IDEA
.idea
*.iml