Skip to content

Instantly share code, notes, and snippets.

@nitinbhojwani
Created December 1, 2017 17:59
Show Gist options
  • Select an option

  • Save nitinbhojwani/457377e8084f87e903967a2e76cc07f3 to your computer and use it in GitHub Desktop.

Select an option

Save nitinbhojwani/457377e8084f87e903967a2e76cc07f3 to your computer and use it in GitHub Desktop.
Run Python script inside Docker container
FROM python:3
ADD script.py /
CMD [ "python", "-u", "./script.py" ]
import time, sched
#
# Define steps functions here
#
# main function
def main(sc):
try:
# Call steps functions here
except Exception as e:
print('Exception Occured', e)
s.enter(30, 1, main, (sc,))
if __name__ == '__main__':
s = sched.scheduler(time.time, time.sleep)
s.enter(30, 1, main, (s,))
s.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment