Reorganization #47
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 Docker Image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
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: Convert repository and owner names to lowercase | |
id: names_lowercase | |
run: | | |
echo "REPO_NAME_LOWER=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
echo "OWNER_NAME_LOWER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build Docker Telegram Bot Image | |
run: | | |
docker buildx build --platform linux/amd64 --load -f .docker/telegram_bot/Dockerfile -t ghcr.io/${{ env.OWNER_NAME_LOWER }}/${{ env.REPO_NAME_LOWER }}:latest . | |
- name: Build Docker MySQL Image | |
run: | | |
docker buildx build --platform linux/amd64 --load -f .docker/mysql/Dockerfile --build-arg BASE_DIRECTORY=.docker -t ghcr.io/${{ env.OWNER_NAME_LOWER }}/${{ env.REPO_NAME_LOWER }}/mysql:8.0.39 . | |
- name: Push Docker images to GitHub Container Registry | |
run: | | |
docker push ghcr.io/${{ env.OWNER_NAME_LOWER }}/${{ env.REPO_NAME_LOWER }}:latest | |
docker push ghcr.io/${{ env.OWNER_NAME_LOWER }}/${{ env.REPO_NAME_LOWER }}/mysql:8.0.39 |