Skip to content

Commit

Permalink
Diagrams (#7)
Browse files Browse the repository at this point in the history
* deployment diagram

* edit
  • Loading branch information
msaunby authored Feb 11, 2023
1 parent adb548b commit 7dce45c
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#
reveal.js-master/
# PlantUML output
out/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
124 changes: 124 additions & 0 deletions flaskserver/static/deployment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 36 additions & 18 deletions flaskserver/static/slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

* What are containers?

* Deployment

* Project repository

* The Dockerfile

* docker build
Expand All @@ -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.
Expand All @@ -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```
Expand All @@ -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
Expand All @@ -100,10 +102,26 @@ jobs:
## ```docker run```

```sh
$ docker run -p 5000:5000 flask-demo
```




## What next?

### Google Cloud Shell

### 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
```
17 changes: 17 additions & 0 deletions slides/build-action.puml
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions slides/deployment.puml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions slides/resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<https://learn.microsoft.com/en-us/azure/developer/python/tutorial-containerize-deploy-python-web-app-azure-04>

0 comments on commit 7dce45c

Please sign in to comment.