IT/Infra&Cloud

[GCP] Building a DevOps Pipeline

Hayley Shim 2021. 8. 22. 22:55

Task 1: Create a Git Repository

Task 2: Create a Simple Python Application

You need some source code to manage. So, you will create a simple Python Flask web application. The application will be only slightly better than "hello world," but it will be good enough to test the pipeline you will build.

 

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route("/")
def main():
    model = {"title": "Hello DevOps Fans."}
    return render_template('index.html', model=model)

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=8080, debug=True, threaded=True)

Task 3: Test Your Web Application in Cloud Shell

 

Task 4: Define a Docker Build

FROM python:3.7
WORKDIR /app
COPY . .
RUN pip install gunicorn
RUN pip install -r requirements.txt
ENV PORT=80
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 main:app

Task 5: Manage Docker Images with Cloud Build and Container Registry

 

Task 6: Automate Builds with Triggers

 

Task 7: Test Your Build Changes

'IT > Infra&Cloud' 카테고리의 다른 글

[NFT]1.NFT Storage Service  (1) 2023.10.28
[NFT]NFT가 Infra 시장에 가져올 변화  (1) 2023.10.28
인프라 자동화(Infrastructure automation)  (0) 2020.12.02
멀티테넌시(Multi Tenancy)  (0) 2020.07.07
SaaS(Software as a service)  (0) 2020.06.05