diff --git a/.gitignore b/.gitignore index b25a3bf..be18c8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # reveal.js-master/ +# PlantUML output +out/ # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/flaskserver/static/deployment.svg b/flaskserver/static/deployment.svg new file mode 100644 index 0000000..9a82634 --- /dev/null +++ b/flaskserver/static/deployment.svg @@ -0,0 +1,124 @@ +GitHub Docker Hub Hosting service ProjectPython appDockerfileDocker imageBase imageProjectDependenciesContainer registrytag:latesttag:v1.1.0tag v1.0.0http://myproject.appapplicationcontainerbuildpushpull \ No newline at end of file diff --git a/flaskserver/static/slides.md b/flaskserver/static/slides.md index 8d5ad25..b0e6fd3 100644 --- a/flaskserver/static/slides.md +++ b/flaskserver/static/slides.md @@ -2,6 +2,10 @@ * What are containers? +* Deployment + +* Project repository + * The Dockerfile * docker build @@ -24,6 +28,22 @@ +## Deployment + +![](deployment.svg) + + + +## Project repository + +As we are going to deploy directly from the repository all dependencies must be included. + +``` +__main__.py +requirement.txt +``` + + ## The Dockerfile The Dockerfile describes how to build the container and, optionally, the command to run. @@ -44,12 +64,6 @@ CMD ["python", "flaskserver"] ``` -Typically containers build on base images that provide a complete run time environment for the programming language used by the application. Where something more bespoke is needed then we can build on base images such as **ubuntu:22.04** and use a package manager to install libraries and tools. e.g. -```yaml -FROM ubuntu:22.04 -RUN apt update && apt install -y --no-install-recommends r-base -``` - ## ```docker build``` @@ -67,31 +81,19 @@ $ docker build . -t flask-demo:latest -## ```docker run``` - -```sh -$ docker run -p 5000:5000 flask-demo -``` - - ## GitHub Actions ```yaml name: Docker Image CI - on: push: branches: [ "main" ] pull_request: branches: [ "main" ] - jobs: - build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Build the Docker image @@ -100,6 +102,15 @@ jobs: +## ```docker run``` + +```sh +$ docker run -p 5000:5000 flask-demo +``` + + + + ## What next? ### Google Cloud Shell @@ -107,3 +118,10 @@ jobs: ### Containers as development environments ### Docker Compose and Kubernetes + + +Typically containers build on base images that provide a complete run time environment for the programming language used by the application. Where something more bespoke is needed then we can build on base images such as **ubuntu:22.04** and use a package manager to install libraries and tools. e.g. +```yaml +FROM ubuntu:22.04 +RUN apt update && apt install -y --no-install-recommends r-base +``` diff --git a/slides/build-action.puml b/slides/build-action.puml new file mode 100644 index 0000000..fedc68f --- /dev/null +++ b/slides/build-action.puml @@ -0,0 +1,17 @@ +@startyaml +name: Docker Image CI + +on: + push: branches: [ "main" ] + pull_request: branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + uses: actions/checkout@v3 + name: Build the Docker image + run: "docker build ...." +@endyaml diff --git a/slides/deployment.puml b/slides/deployment.puml new file mode 100644 index 0000000..608a32f --- /dev/null +++ b/slides/deployment.puml @@ -0,0 +1,53 @@ +@startuml +!pragma layout smetana + +cloud "GitHub\n" { +card project [ + Project + ---- + Python app + .... + Dockerfile +] + +card image [ + Docker image + ---- + Base image + .... + Project + .... + Dependencies +] + +} + +cloud "Docker Hub\n" { +card registry [ + Container registry + ---- + tag:latest + .... + tag:v1.1.0 + .... + tag v1.0.0 + .... +] +} + +' thing +together { +cloud "Hosting service\n" { + card container[ + application + container + ] +} +actor "http://myproject.app" as a +} + +project -> image : " build " +image --> registry : push +registry -r-> container : " pull " +container --> a +@enduml \ No newline at end of file diff --git a/slides/resources.md b/slides/resources.md new file mode 100644 index 0000000..5a5d865 --- /dev/null +++ b/slides/resources.md @@ -0,0 +1 @@ + \ No newline at end of file