Build Image and Push #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Stunnel to Dockerhub | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * SUN' | |
jobs: | |
build-push-stunnel: | |
runs-on: stunnel | |
env: | |
DOCKERHUB_REPO: bonztm/stunnel | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 | |
- name: Get current date | |
id: date | |
run: echo "date=$(date --rfc-3339=date)" >> $GITHUB_OUTPUT | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Create docker context | |
run: | | |
docker context create stunnel | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: stunnel | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.DOCKERHUB_REPO }}:latest,${{ env.DOCKERHUB_REPO }}:${{ steps.date.outputs.date }} | |
- name: Remove docker context | |
if: always() | |
run: docker context rm stunnel | |
- name: Update Dockerhub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: ${{ env.DOCKERHUB_REPO }} | |
readme-filepath: README.md | |
short-description: ${{ github.event.repository.description }} |