diff --git a/answers.md b/answers.md index 25c43e4..92b2e60 100644 --- a/answers.md +++ b/answers.md @@ -1,46 +1,72 @@ # Answers -Nom: -Prénom: -NB: +Nom: Asmar +Prénom: Estelle +NB: 6 ## 1.3 -command: +command: docker build . ## 1.4 -answer: -command: +answer:L'adresse URL ne répond rien car les ports ne sont pas ouverts. +command: docker run -p 8080:8080 tp2 ## 1.5 -command: +command: docker run -p 8080:8080 -e ENVIRONMENT=dev tp2 ## 1.6 -answer: -command: +answer:Mon image ne peut pas être poussée telle qu'elle est car elle nécessite un TAG. +command: +docker tag 1354c1ef075e ab12cd34/repository1:premiertest +docker push ab12cd34/repository1 ## 1.7 -answer: -command: -command: -command: +answer: Il faut ajouter ab12cd34/repository1 +command:sudo docker rmi -f $(docker images -q) +command:docker run -p 8080:8080 -e ENVIRONMENT=dev ab12cd34/repository1:premiertest +command:docker run -p 8080:8080 -e ENVIRONMENT=dev -d ab12cd34/repository1:premiertest ## 1.8 -answer: -command: -command: +answer: En mode détaché, nous pouvons vérifier que le container démarre bien lorsqu'on le relance une fois que nous ayons quitté le terminal. +command: docker ps +command: sudo docker rename stoic_sinoussi dockername + docker restart dockername ## 1.9 +answer: L'OS utilisé dans le container est Debian GNU/Linux 9 + answer: -answer: + +PRETTY_NAME="Debian GNU/Linux 9 (stretch)" +NAME="Debian GNU/Linux" +VERSION_ID="9" +VERSION="9 (stretch)" +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" ## 1.11 -command: +command: docker run -p 8081:8081 -e APP_PORT=8081 -e WS_BACK_URL=172.17.0.1 -d tp2front + +http://localhost:8081/estelle +You called at : 2018-11-20 12:35:48.125434 (dynamic) + On environment : dev (from env variable) + With path : estelle (from URL path) + With front : 20250db07e86 (from real hostname of front service) + With back : 1f81551ed70d (from real hostname of back service) + ## 2.1 -command: +command: docker-compose run -p 8080:8080 -e ENVIRONMENT=dev service-back + docker-compose up ## 2.6 -command: -command: +command: docker-compose up -d +command: docker-compose logs + +## 2.9 +command: docker-compose up -d --scale repository1=2 + diff --git a/app/back/Dockerfile b/app/back/Dockerfile new file mode 100644 index 0000000..71f7fcf --- /dev/null +++ b/app/back/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3 + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD [ "python", "-u", "./webservice.py" ] diff --git a/app/back/logs/my_messages.log b/app/back/logs/my_messages.log new file mode 100644 index 0000000..e69de29 diff --git a/app/docker-compose.yml b/app/docker-compose.yml new file mode 100644 index 0000000..9e2e0e5 --- /dev/null +++ b/app/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' +services: + service-back: + image: 1354c1ef075e + environment: + - ENVIRONMENT=dev + #volumes: + #- logs + service-front: + image: 885e244446d5 + ports: + - "8081:8081" + environment: + - APP_PORT=8081 + - WS_BACK_URL=back + links: + - "service-back:back" +#volumes: + #logs: + + + + + + diff --git a/app/front/Dockerfile b/app/front/Dockerfile new file mode 100644 index 0000000..7310355 --- /dev/null +++ b/app/front/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3 + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD [ "python", "-u", "./front.py" ]