Autorun script #45
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 App Docker | |
on: | |
push: | |
paths: | |
- "Dockerfile" | |
- ".github/workflows/build-docker.yml" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Convert repository name to lower case | |
id: LowCaseRepoName | |
run: echo "REPO=$(echo ${{ github.repository }} | awk '{print tolower($0)}')" >> $GITHUB_ENV | |
- name: Setup Git | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
- name: Checkout code | |
run: | | |
git clone https://github.com/${{ github.repository }} . | |
git checkout ${{ github.sha }} | |
- name: Build docker image | |
run: | | |
cd ${{ github.workspace }} | |
docker build -t ghcr.io/$REPO/app-image:latest . | |
- name: Login to GH registry | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
- name: Push Docker image | |
run: | | |
docker push ghcr.io/$REPO/app-image:latest |