From f5cd57d27176bff75254340bbf99a6ae2fe421ca Mon Sep 17 00:00:00 2001 From: Sathyajith Bhat Date: Fri, 16 Jul 2021 18:20:11 +0300 Subject: [PATCH] change to python 3 syntax --- .../chapter-4/exercise-1/docker-hello-world/Dockerfile | 3 +-- .../chapter-4/exercise-1/docker-hello-world/hello-world.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source-code/chapter-4/exercise-1/docker-hello-world/Dockerfile b/source-code/chapter-4/exercise-1/docker-hello-world/Dockerfile index 7c1d5ab..620cf40 100644 --- a/source-code/chapter-4/exercise-1/docker-hello-world/Dockerfile +++ b/source-code/chapter-4/exercise-1/docker-hello-world/Dockerfile @@ -1,9 +1,8 @@ FROM python:3-alpine -LABEL author="sathyabhat" LABEL description="Dockerfile for Python script which prints Hello, Name" COPY hello-world.py /app/ -ENV NAME=Sathya +ENV NAME=Readers CMD python3 /app/hello-world.py diff --git a/source-code/chapter-4/exercise-1/docker-hello-world/hello-world.py b/source-code/chapter-4/exercise-1/docker-hello-world/hello-world.py index 850eed0..49e450d 100644 --- a/source-code/chapter-4/exercise-1/docker-hello-world/hello-world.py +++ b/source-code/chapter-4/exercise-1/docker-hello-world/hello-world.py @@ -1,10 +1,8 @@ #!/usr/bin/env python3 - from os import getenv if getenv('NAME') is None: name = 'World' else: name = getenv('NAME') - -print("Hello, {}!".format(name)) +print(f"Hello, {name}!")