Skip to content

Commit

Permalink
v0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
a3888s committed Dec 21, 2024
1 parent e859da7 commit 60e598b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/docker-build-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ jobs:
release:
if: github.event.pull_request.merged == true # Виконується тільки якщо PR був merged
runs-on: ubuntu-latest
permissions:
contents: write # Дозволяє створювати релізи


steps:
# Крок 1: Клонування репозиторію
- name: Checkout code
uses: actions/checkout@v3

# Крок 2: Завантаження .env
- name: Load .env file
run: |
set -a
source .env
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
# Крок 3: Логін у Docker Hub
- name: Login to Docker Hub
Expand All @@ -31,15 +33,20 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Крок 4: Побудова Docker-образу
- name: Build Docker Image
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/step-final-project-prod:${{ env.DOCKER_TAG }} -f app/Dockerfile app/
docker build -t "${{ secrets.DOCKERHUB_USERNAME }}/step-final-project-prod:${DOCKER_TAG}" -f app/Dockerfile app/
# Крок 5: Завантаження Docker-образу
# Завантаження Docker-образу
- name: Push Docker Image
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/step-final-project-prod:${{ env.DOCKER_TAG }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/step-final-project-prod:${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
# Крок 6: Створення GitHub-релізу
- name: Create GitHub Release
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ jobs:
run: |
set -a
source .env
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
set +a
- name: Verify DOCKER_TAG
run: |
echo "DOCKER_TAG=${DOCKER_TAG}"
# Логін у Docker Hub
- name: Login to Docker Hub
Expand All @@ -30,7 +35,7 @@ jobs:
- 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: |
Expand Down
4 changes: 2 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def do_GET(self):
</style>
</head>
<body>
<h1>StepFinalProject v 0.0.4</h1>
<h1>StepFinalProject v 0.0.5</h1>
</body>
</html>
"""
Expand All @@ -41,6 +41,6 @@ def do_GET(self):
# Основна частина програми
if __name__ == "__main__":
server = HTTPServer(("0.0.0.0", 8080), SimpleHandler) # Ініціалізація сервера на порту 8080
version = "v 0.0.4"
version = "v 0.0.5"
print(f"StepFinalProject {version}") # Виведення інформації про запуск у консоль
server.serve_forever() # Запуск сервера для обробки запитів
2 changes: 1 addition & 1 deletion app/k8s/dev/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ spec:
spec:
containers:
- name: python-backend
image: a3888s/step-final-project:v0.0.4
image: a3888s/step-final-project:v0.0.5
ports:
- containerPort: 8080 # Відкритий порт контейнера
6 changes: 2 additions & 4 deletions app/k8s/prod/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -14,8 +13,7 @@ spec:
app: python-backend # Мітка для подів
spec:
containers:
- name: python-backend # Назва контейнера
image: >
a3888s/step-final-project:${DOCKER_TAG} # Образ контейнера із тегом версії
- name: python-backend
image: a3888s/step-final-project-prod:v0.0.5
ports:
- containerPort: 8080 # Відкритий порт контейнера

0 comments on commit 60e598b

Please sign in to comment.