Skip to content

Commit efad2d2

Browse files
DEVOPS-263 dockerization of application
1 parent 1b85e6b commit efad2d2

File tree

6 files changed

+105
-0
lines changed

6 files changed

+105
-0
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.jpg
2+
*.jpeg
3+
*.md
4+
.gitignore
5+
LICENSE

.github/dependabot.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: /
5+
schedule:
6+
interval: "weekly"
7+
day: wednesday
8+
time: "11:30"
9+
timezone: Asia/Kolkata
10+
# Assignees to set on pull requests
11+
assignees:
12+
- "githubofkrishnadhas"
13+
# prefix specifies a prefix for all commit messages. When you specify a prefix for commit messages,
14+
# GitHub will automatically add a colon between the defined prefix and the commit message provided the
15+
# defined prefix ends with a letter, number, closing parenthesis, or closing bracket.
16+
commit-message:
17+
prefix: "dependabot python package"
18+
# Use reviewers to specify individual reviewers or teams of reviewers for all pull requests raised for a package manager.
19+
reviewers:
20+
- "devwithkrishna/admin"
21+
# Raise pull requests for version updates to pip against the `main` branch
22+
target-branch: "main"
23+
# Labels on pull requests for version updates only
24+
labels:
25+
- "pip dependencies"
26+
- "pip-packages"
27+
# Increase the version requirements for Composer only when required
28+
versioning-strategy: increase-if-necessary
29+
# Dependabot opens a maximum of five pull requests for version updates. Once there are five open pull requests from Dependabot,
30+
# Dependabot will not open any new requests until some of those open requests are merged or closed.
31+
# Use open-pull-requests-limit to change this limit.
32+
open-pull-requests-limit: 10

.github/workflows/build-ci.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: azure-app-to-get-image-details-from-acr
2+
on:
3+
workflow_dispatch:
4+
5+
run-name: azure-app-to-get-image-details-from-acr
6+
env:
7+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
8+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
9+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
10+
11+
jobs:
12+
azure-app-to-get-image-details-from-acr:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Build and publish docker image with tag
32+
uses: docker/build-push-action@v6
33+
with:
34+
push: true
35+
file: Dockerfile
36+
tags: |
37+
${{ secrets.DOCKERHUB_USERNAME }}/azure-app-to-get-image-details-from-acr:latest
38+
39+
- name: Completed
40+
run: |
41+
echo "program completed successfully"

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# base image python 3.11 debian12
2+
FROM python:3.11-slim-bookworm
3+
# label
4+
LABEL maintained-by="githubofkrishnadhas"
5+
# setting workdir
6+
WORKDIR /app
7+
# copying files
8+
COPY . /app/
9+
# package updations and installations
10+
RUN apt-update && pip install --upgrade pip && apt install poetry -y && chmod +x entrypoint.sh
11+
# code file to execute when the docker container starts up (`entrypoint.sh`)
12+
ENTRYPOINT ["/app/entrypoint.sh"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ This app helps in displaying image details available in an azure container regis
2525
has enough permissions to list images, Acess ACR's. This class `EnvironmentCredential` been used.
2626
[azure-identity](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python)
2727

28+
| variable name | value |
29+
|---------------------|-------------------------------------------------|
30+
| AZURE_CLIENT_ID | ID of a Microsoft Entra application |
31+
| AZURE_TENANT_ID | ID of the application's Microsoft Entra tenant |
32+
| AZURE_CLIENT_SECRET | one of the application's client secrets |
33+
34+
**The above environment variables are required**. [service-principal-with-secret](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#service-principal-with-secret)
35+
2836
* Microsoft Azure Container Registry Client Library for Python is used to list all images and tags in a ACR.
2937
[azure-containerregistry](https://learn.microsoft.com/en-us/python/api/overview/azure/containerregistry-readme?view=azure-python)
3038

entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
3+
# installng poetry and creating poetry venv
4+
cd /app && poetry install
5+
6+
# run python program to start streamlit app
7+
poetry run streamlit run /app/streamlit.py

0 commit comments

Comments
 (0)