Skip to content

Commit 03b720a

Browse files
Merge pull request #14 from vectornguyen76/staging
Done update CICD
2 parents d7badb2 + 9562207 commit 03b720a

File tree

7 files changed

+58
-42
lines changed

7 files changed

+58
-42
lines changed

.github/workflows/ansible/deploy_applications.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
- ansible_host_key_checking: false
1010
- ansible_stdout_callback: yaml
1111

12-
- api_image_image: vectornguyen76/flask_template_image
13-
- api_image_tag: latest
12+
- flask_template_image: vectornguyen76/flask_template_image
13+
- flask_template_tag: latest
1414

1515
pre_tasks:
1616
- name: "wait 600 seconds for target connection to become reachable/usable."

.github/workflows/ansible/roles/deploy/tasks/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
src: "/home/ubuntu/server/artifact.zip"
1616
dest: "/home/ubuntu/server"
1717

18-
- name: Pull api image
18+
- name: Pull flask template image
1919
community.docker.docker_image:
20-
name: "{{ api_image }}"
21-
tag: "{{ api_tag }}"
20+
name: "{{ flask_template_image }}"
21+
tag: "{{ flask_template_tag }}"
2222
source: pull
2323

2424
- name: Run docker compose

.github/workflows/development_pipeline.yml

+10-30
Original file line numberDiff line numberDiff line change
@@ -47,41 +47,21 @@ jobs:
4747
DATABASE_TEST_URL: postgresql://db_user:db_password@localhost/db_test
4848
run: python -m flask tests
4949

50-
deploy-service:
51-
needs: build-test
52-
runs-on: ubuntu-latest
53-
env:
54-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
55-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
56-
AWS_REGION: "us-east-1"
57-
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
58-
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
59-
steps:
60-
- name: Checkout Repository
61-
uses: actions/checkout@v2
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v2
6252

6353
- name: Login to Docker Hub
6454
id: docker_hub_auth
65-
uses: docker/login-action@v1
55+
uses: docker/login-action@v2
6656
with:
6757
username: ${{ secrets.DOCKERHUB_USERNAME }}
6858
password: ${{ secrets.DOCKERHUB_PASSWORD }}
6959

70-
- name: Build Docker Image
71-
id: build_docker
72-
run: |
73-
docker compose build api_service
74-
75-
# Add tag
76-
docker tag api_image:latest ${{ secrets.DOCKERHUB_USERNAME }}/api_image:latest
77-
78-
- name: Push Docker Image
79-
id: push_images
80-
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/api_image:latest
81-
82-
- name: Deploy to AWS CloudFormation
83-
uses: aws-actions/aws-cloudformation-github-deploy@v1
60+
- name: Build and push
61+
uses: docker/build-push-action@v4
8462
with:
85-
name: MyStackEC2
86-
template: myStack.yaml
87-
parameter-overrides: "MyParam1=myValue,MyParam2=${{ secrets.MY_SECRET_VALUE }}"
63+
context: .
64+
push: true
65+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flask_template_image:latest
66+
cache-from: type=gha
67+
cache-to: type=gha,mode=max

.github/workflows/production_pipeline.yaml renamed to .github/workflows/production_pipeline.yml

+19-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
branches:
55
- master
66

7-
push:
8-
branches:
9-
- master
107
jobs:
118
build-test:
129
runs-on: ubuntu-latest
@@ -47,6 +44,25 @@ jobs:
4744
DATABASE_TEST_URL: postgresql://db_user:db_password@localhost/db_test
4845
run: python -m flask tests
4946

47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v2
49+
50+
- name: Login to Docker Hub
51+
id: docker_hub_auth
52+
uses: docker/login-action@v2
53+
with:
54+
username: ${{ secrets.DOCKERHUB_USERNAME }}
55+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
56+
57+
- name: Build and push
58+
uses: docker/build-push-action@v4
59+
with:
60+
context: .
61+
push: true
62+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flask_template_image:latest
63+
cache-from: type=gha
64+
cache-to: type=gha,mode=max
65+
5066
create-config-infrastructure:
5167
runs-on: ubuntu-latest
5268
needs:

.github/workflows/staging_pipeline.yaml renamed to .github/workflows/staging_pipeline.yml

+19-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
branches:
55
- staging
66

7-
push:
8-
branches:
9-
- staging
107
jobs:
118
build-test:
129
runs-on: ubuntu-latest
@@ -47,6 +44,25 @@ jobs:
4744
DATABASE_TEST_URL: postgresql://db_user:db_password@localhost/db_test
4845
run: python -m flask tests
4946

47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v2
49+
50+
- name: Login to Docker Hub
51+
id: docker_hub_auth
52+
uses: docker/login-action@v2
53+
with:
54+
username: ${{ secrets.DOCKERHUB_USERNAME }}
55+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
56+
57+
- name: Build and push
58+
uses: docker/build-push-action@v4
59+
with:
60+
context: .
61+
push: true
62+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flask_template_image:latest
63+
cache-from: type=gha
64+
cache-to: type=gha,mode=max
65+
5066
create-config-infrastructure:
5167
runs-on: ubuntu-latest
5268
needs:

instructions/anaconda-miniconda.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
```
3434

3535
### Install Miniconda - use the following commands consecutively
36+
3637
- Download miniconda
3738
```shell
3839
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
@@ -41,7 +42,7 @@
4142
```shell
4243
sha256sum Miniconda3-latest-Linux-x86_64.sh
4344
```
44-
- The output will notify if any errors occurred. If there are no errors, move on to the actual installation step. To continue, run the Anaconda bash shell script:
45+
- The output will notify if any errors occurred. If there are no errors, move on to the actual installation step. To continue, run the Anaconda bash shell script:
4546
```shell
4647
bash Miniconda3-latest-Linux-x86_64.sh
4748
```

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ alembic==1.10.2
22
apispec==6.3.0
33
asttokens==2.2.1
44
backcall==0.2.0
5+
black==23.9.1
56
blinker==1.5
67
certifi==2023.5.7
78
click==8.1.3
@@ -14,6 +15,7 @@ distlib==0.3.6
1415
entrypoints==0.4
1516
executing==1.2.0
1617
filelock==3.12.2
18+
flake8==6.1.0
1719
Flask==2.2.5
1820
Flask-Cors==3.0.10
1921
Flask-JWT-Extended==4.4.4
@@ -27,6 +29,7 @@ gunicorn==20.1.0
2729
importlib-metadata==6.7.0
2830
ipykernel==6.19.2
2931
ipython==8.10.0
32+
isort==5.12.0
3033
itsdangerous==2.1.2
3134
jedi==0.18.2
3235
Jinja2==3.1.2

0 commit comments

Comments
 (0)