Build and push image #1
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 image | |
on: | |
workflow_dispatch: | |
env: | |
IMAGE_NAMESPACE: csiesnmg | |
IMAGE_NAME: pure-ftpd-mysql | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
name: "Build Docker image and push to Docker Hub" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set variables | |
shell: python3 | |
run: | | |
import os | |
os.environ['GITHUB_ENV_'] | |
os.environ['IMAGE_TAG'] = os.environ['GITHUB_SHA'][:7] | |
- name: Build frontend and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:buster |