Skip to content

Commit

Permalink
docker: refactor folder (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungbq committed Jul 29, 2023
2 parents 0e2f6f2 + bf7de29 commit 462d2a0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/hands-on/python-sample/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.8
WORKDIR /
COPY requirements.txt .
# RUN pip install -r requirements.txt
COPY . .
CMD [ "python", "random.py" ]
1 change: 1 addition & 0 deletions docker/hands-on/python-sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Link to practice script](practice.sh)
1 change: 1 addition & 0 deletions docker/hands-on/python-sample/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello")
11 changes: 11 additions & 0 deletions docker/hands-on/python-sample/practice.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Running python script without building docker image
echo "Running python script without building docker image"
docker run --rm -v $(pwd):/app -w /app python:3.9-slim-buster python basic.py
echo $?
# Build and run docker container
echo "Build and run docker container"
IMAGE_NAME="random_python:latest"
docker build -t $IMAGE_NAME .
docker run --rm $IMAGE_NAME
4 changes: 4 additions & 0 deletions docker/hands-on/python-sample/random.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import datetime
now = datetime.datetime.now()
print ("Current date and time : ")
print (now.strftime("%Y-%m-%d %H:%M:%S"))
1 change: 1 addition & 0 deletions docker/hands-on/python-sample/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
random

0 comments on commit 462d2a0

Please sign in to comment.