v1.0.2 #57
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: | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Клонування репозиторію | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Завантаження .env | |
- name: Load .env file | |
run: | | |
set -a | |
source .env | |
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV | |
- name: Verify DOCKER_TAG | |
run: | | |
echo "DOCKER_TAG=${DOCKER_TAG}" | |
# Логін у Docker Hub | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker Image | |
run: | | |
docker build -t "${{ secrets.DOCKERHUB_USERNAME }}/step-final-project:${DOCKER_TAG}" -f app/Dockerfile app/ | |
# Завантаження Docker-образу | |
- name: Push Docker Image | |
run: | | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/step-final-project:${DOCKER_TAG} | |
# Лінтинг DEV та PROD YAML | |
- name: Lint Kubernetes YAML | |
run: | | |
yamllint -c .yamllint app/k8s/dev/deployment.yaml | |
yamllint -c .yamllint app/k8s/prod/deployment.yaml |