Skip to content

Commit 0142dbc

Browse files
committed
Initial commit for test branch
0 parents  commit 0142dbc

5 files changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/ci-cd-main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build & Push - Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Log in to DockerHub
15+
uses: docker/login-action@v3
16+
with:
17+
username: ${{ secrets.DOCKER_USERNAME }}
18+
password: ${{ secrets.DOCKER_TOKEN }}
19+
20+
- name: Build & push main image
21+
uses: docker/build-push-action@v5
22+
with:
23+
context: .
24+
push: true
25+
tags: ${{ secrets.DOCKER_USERNAME }}/python-sample:main

.github/workflows/ci-cd-test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build & Push - Test
2+
3+
on:
4+
push:
5+
branches: [test]
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Log in to DockerHub
15+
uses: docker/login-action@v3
16+
with:
17+
username: ${{ secrets.DOCKER_USERNAME }}
18+
password: ${{ secrets.DOCKER_TOKEN }}
19+
20+
- name: Build & push test image
21+
uses: docker/build-push-action@v5
22+
with:
23+
context: .
24+
push: true
25+
tags: ${{ secrets.DOCKER_USERNAME }}/python-sample:test

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.11-slim
2+
WORKDIR /app
3+
COPY . .
4+
EXPOSE 80
5+
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
CMD ["python", "app.py"]

app.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from flask import Flask
2+
app = Flask(__name__)
3+
4+
@app.route('/')
5+
def home():
6+
return "Hello from Python in Docker!"
7+
8+
if __name__ == '__main__':
9+
app.run(host='0.0.0.0', port=80)

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flask

0 commit comments

Comments
 (0)