Browse Source

Initial commit

main
TristanSixOSF 5 years ago
commit
c5d953979f
  1. 36
      0_run/Readme.md
  2. 1
      0_run/commands.sh
  3. 51
      1_dockerfile/Readme.md
  4. 0
      1_dockerfile/bash/Dockerfile
  5. 9
      1_dockerfile/bash/to_run.sh
  6. 0
      1_dockerfile/curl/Dockerfile
  7. 0
      1_dockerfile/python/Dockerfile
  8. 15
      1_dockerfile/python/app.py
  9. 2
      1_dockerfile/python/requirements.txt
  10. 5
      2_compose/Readme.md
  11. 0
      2_compose/docker-compose.yml
  12. 10
      Readme.md

36
0_run/Readme.md

@ -0,0 +1,36 @@
# Run TP
Add all of thoses script in the `commands.sh` file
## Hello docker
I want a docker run command to show this using the `docker/whalesay` image :
```bash
__________________
< Hello M1 III 2021 >
------------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
```
And I want, with that same command, for the container to be **deleted**.
## Interactive python shell
I don't have admin rights on my computer and I want to test something with python 3.
With a `docker container run`, start an **interactive** container with python 3 running.
And I want, with that same command, for the container to be **deleted** when I'm done.

1
0_run/commands.sh

@ -0,0 +1 @@
#!/bin/bash

51
1_dockerfile/Readme.md

@ -0,0 +1,51 @@
# Dockerfile tp
Write dockerfile for each folder.
## Package curl
My computer dosen't have curl installed, and I want a docker to run curl on my laptop (as shown with python in the previous tp).
I want to be able to do this :
```bash
cd curl
docker image build -t my-curl .
```
And then, run it.
You have to do is to **write the Dockerfile**.
I want to use it like that :
```bash
docker container run --rm my-curl:latest https://example.com
```
## Package my bash script
I want the script in the folder bash to be run within a `ubuntu` container.
**You must write the dockerfile.**
## Package a python app
I want my python app to be packaged in a docker container using python **2.7**.
You have to do is to **write the Dockerfile**.
I want to run it like that :
```bash
docker run -d -p 5000:5000 my-hello-world
```
And I want it to be pushed on docker hub.
Tips :
To install dependancies, you must run `pip install -r requirements.txt` in the container.
Don't forget to copy requirements.txt too !

0
1_dockerfile/bash/Dockerfile

9
1_dockerfile/bash/to_run.sh

@ -0,0 +1,9 @@
#!/bin/bash
RELEASE=$(head -n 1 < /etc/lsb-release | cut -d '=' -f 2)
if [ "$RELEASE" = "Ubuntu" ]; then
echo Good ! It\'s Ubuntu
else
echo Oh no, i\'ts not Ubuntu...
fi

0
1_dockerfile/curl/Dockerfile

0
1_dockerfile/python/Dockerfile

15
1_dockerfile/python/app.py

@ -0,0 +1,15 @@
# app.py - a minimal flask api using flask_restful
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
api.add_resource(HelloWorld, '/')
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')

2
1_dockerfile/python/requirements.txt

@ -0,0 +1,2 @@
flask
flask_restful

5
2_compose/Readme.md

@ -0,0 +1,5 @@
# Convos docker compose
I want a `docker-compose.yml` to start a convos (https://convos.chat/) on the port 2021 and persist the data in a folder of your choise.
**You must write the docker-compose.yml.**

0
2_compose/docker-compose.yml

10
Readme.md

@ -0,0 +1,10 @@
# TP Docker
First of all, click the "This template" button to create your repo.
Then, you must folow each folders to see what you must do.
Then, you must submit on the https://courso.beaussan.io/ platform (Login with the email you provided in the last TP).
You must submit the public url of the repo **once you are done**. And when you submit, the repo needs to be public.
Loading…
Cancel
Save