Skip to content

Commit

Permalink
more separations
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Jun 2, 2020
1 parent 46c8d8e commit cfb55d1
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 120 deletions.
10 changes: 10 additions & 0 deletions docker/appendix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Appendix
{id: appendix}

## Links
{id: links}

* [flask uwsgi nginx](https://medium.com/@gabimelo/developing-a-flask-api-in-a-docker-container-with-uwsgi-and-nginx-e089e43ed90e)
* [deploy on Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-go-web-application-with-docker-and-nginx-on-ubuntu-18-04)


16 changes: 0 additions & 16 deletions docker/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,22 +349,6 @@ docker: Error response from daemon: oci runtime error: container_linux.go:247: s
ERRO[0001] error getting events from daemon: net/http: request canceled
```

## Links
{id: links}

* [flask uwsgi nginx](https://medium.com/@gabimelo/developing-a-flask-api-in-a-docker-container-with-uwsgi-and-nginx-e089e43ed90e)
* [deploy on Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-go-web-application-with-docker-and-nginx-on-ubuntu-18-04)

## Docker: Flask + uwsgi + nginx
{id: flask-uwsgi-nginx}

Using [https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/](https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/)

```
docker build -t myapp .
docker run -it --rm -p5001:80 myapp
```

## Run container as a daemon
{id: run-container-as-a-daemon}
{i: inspect}
Expand Down
3 changes: 2 additions & 1 deletion docker/docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"commands.md",
"python.md",
"perl.md",
"compose.md"
"compose.md",
"appendix.md"
]
}
103 changes: 0 additions & 103 deletions docker/part2.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,62 +110,6 @@ $ docker run -it --rm mydocker
hello world
```

## Docker: Perl Hello World
{id: docker-perl-hello-world}

![](examples/hello-world-perl/Dockerfile)

```
$ docker build -t mydocker .
$ docker run -it --rm mydocker
Hello from Perl
```

## Docker: Perl Hello World in script
{id: docker-perl-script-hello-world}

![](examples/hello-world-perl-script/Dockerfile)

![](examples/hello-world-perl-script/hello_world.pl)

```
$ docker build -t mydocker .
$ docker run -it --rm mydocker
Hello World from Perl script
```

## Docker: Perl with I/O
{id: docker-perl-with-io}

![](examples/perl-io/Dockerfile)

![](examples/perl-io/greetings.pl)

```
$ docker build -t mydocker .
```

We need to tell Docker that this is an interactive process

```
docker run -it --rm mydocker
What is your name? Foo
Hello Foo, how are you today?
```

## Installing Python in Docker
{id: installing-python-in-docker}

![](examples/python-1/Dockerfile)

```
$ docker build -t mydocker .
$ docker run --rm -it mydocker
# which python3
```

## Docker history
{id: docker-history}

Expand All @@ -192,29 +136,6 @@ docker history mydocker
![](examples/dock/history_mydocker.out)


## Installing Python in Docker - one layer
{id: installing-python-in-docker-one-layer}

![](examples/python-2/Dockerfile)

```
$ docker build -t mydocker2 .
$ docker history mydocker2
```
![](examples/dock/history_mydocker2.out)

## Python CLI in Docker
{id: python-cli-in-docker}

![](examples/python-3/curl.py)

![](examples/python-3/Dockerfile)


```
$ docker build -t mydocker .
```

## Docker: Mounting host directory
{id: docker-mounting-host-directory}

Expand Down Expand Up @@ -268,30 +189,6 @@ $ docker build -t mydocker .
$ docker run --rm mydocker https://code-maven.com/slides
```

## Flask application
{id: flask-application}

![](examples/flask-development/app.py)

![](examples/flask-development/templates/echo.html)

![](examples/flask-development/requirements.txt)


## Flask development
{id: flask-development}

![](examples/flask-development/Dockerfile)

```
$ docker build -t mydocker .
$ docker run -it --name dev --rm -p:5001:5000 -v $(pwd):/opt/ mydocker
```

Access via [http://localhost:5001/](http://localhost:5001/)

The -it is needed so we can see the log on the command line and we can easily stop the development container.


## Docker with crontab
{id: docker-with-crontab}
Expand Down
45 changes: 45 additions & 0 deletions docker/perl.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
# Perl with Docker
{id: perl}

## Docker: Perl Hello World
{id: docker-perl-hello-world}

![](examples/hello-world-perl/Dockerfile)

```
$ docker build -t mydocker .
$ docker run -it --rm mydocker
Hello from Perl
```

## Docker: Perl Hello World in script
{id: docker-perl-script-hello-world}

![](examples/hello-world-perl-script/Dockerfile)

![](examples/hello-world-perl-script/hello_world.pl)

```
$ docker build -t mydocker .
$ docker run -it --rm mydocker
Hello World from Perl script
```

## Docker: Perl with I/O
{id: docker-perl-with-io}

![](examples/perl-io/Dockerfile)

![](examples/perl-io/greetings.pl)

```
$ docker build -t mydocker .
```

We need to tell Docker that this is an interactive process

```
docker run -it --rm mydocker
What is your name? Foo
Hello Foo, how are you today?
```


## Docker Perl Dancer hello world app
{id: docker-perl-dancer-hello-world-app}

Expand Down
70 changes: 70 additions & 0 deletions docker/python.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,66 @@
# Python with Docker
{id: python-with-docker}

## Installing Python in Docker
{id: installing-python-in-docker}

![](examples/python-1/Dockerfile)

```
$ docker build -t mydocker .
$ docker run --rm -it mydocker
# which python3
```

## Installing Python in Docker - one layer
{id: installing-python-in-docker-one-layer}

![](examples/python-2/Dockerfile)

```
$ docker build -t mydocker2 .
$ docker history mydocker2
```
![](examples/dock/history_mydocker2.out)

## Python CLI in Docker
{id: python-cli-in-docker}

![](examples/python-3/curl.py)

![](examples/python-3/Dockerfile)


```
$ docker build -t mydocker .
```

## Flask application
{id: flask-application}

![](examples/flask-development/app.py)

![](examples/flask-development/templates/echo.html)

![](examples/flask-development/requirements.txt)


## Flask development
{id: flask-development}

![](examples/flask-development/Dockerfile)

```
$ docker build -t mydocker .
$ docker run -it --name dev --rm -p:5001:5000 -v $(pwd):/opt/ mydocker
```

Access via [http://localhost:5001/](http://localhost:5001/)

The -it is needed so we can see the log on the command line and we can easily stop the development container.



## Docker: Flask + uwsgi
{id: flask-uwsgi}
Expand All @@ -9,4 +69,14 @@

![](examples/flask-uwsgi/uwsgi.ini)

## Docker: Flask + uwsgi + nginx
{id: flask-uwsgi-nginx}

Using [https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/](https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/)

```
docker build -t myapp .
docker run -it --rm -p5001:80 myapp
```


0 comments on commit cfb55d1

Please sign in to comment.