Fix code scanning alert no. 1: Flask app is run in debug mode #26
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
# .github/workflows/docker-image.yml | |
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- main | |
- 'prerelease-*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set repository name to lowercase | |
id: lowercase_repo | |
run: echo "REPO=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
- name: Determine Docker tag | |
id: get_tag | |
run: | | |
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then | |
echo "tag=latest" >> $GITHUB_OUTPUT | |
elif [[ "${GITHUB_REF}" == refs/heads/prerelease-* ]]; then | |
echo "tag=prerelease" >> $GITHUB_OUTPUT | |
else | |
echo "tag=prerelease" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ steps.lowercase_repo.outputs.REPO }}/tasks:${{ steps.get_tag.outputs.tag || 'prerelease' }} |