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

github action to build and push django-docker-box to dockerhub #43

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
55 changes: 55 additions & 0 deletions .github/workflows/dockerhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: ci

on:
push:
branches:
- 'main'
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
-
name: Check out the docker repo
uses: actions/checkout@v3
with:
path: dockerdir
-
name: Check out the django repo
uses: actions/checkout@v3
with:
repository: django/django
path: djangodir
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/django-docker-box
-
name: Build and push
uses: docker/build-push-action@v3
with:
push: true
context: djangodir
file: dockerdir/Dockerfile
build-args: PYTHON_VERSION=${{ matrix.python-version }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/django-docker-box:${{ matrix.python-version }}