Giter VIP home page Giter VIP logo

docker-template's Introduction

Overview

A base project setup template for using Docker for a Python project.

Possible changes needed

Dockerfile

  • Check the version of Python at the top
  • In the Dockerfile, change src/ to top-level project directory

script/app-env

  • Change DOCKER_IMAGE name to match your repo name (line 10)
  • Change appdir:/src to appdir:/your-top-dir (line 12)

script/bootstrap-docker

  • Change the final name to your repo name - make sure to leave a space between the repo name and the final period (line 7)

script/run

  • Change the structure of this file to call your actual application.
  • The path insertion on line 7 allows you to import your modules from the src/ directory (or whatever you end up calling it).

script/test

  • Change the /src to your top-level project directory (line 8)

src/ files

  • This directory is where your application goes. It can be named differently and you should change the example stub file in this directory.

Other

  • Load requirements.txt with what you need
  • Don't forget to copy over the .gitignore and .dockerignore file

Setup

To create the Docker container, run $ script/bootstrap-docker

Running applications

  • The design of this setup is to allow for CLI by using the script/run file as the entry point into the application. Given this setup, to run you call, script/app-env script/run plus any command line arguments. The script/app-env part puts you into the Docker container's environment, and the script/run part is the entry point into the application as mentioned above.
  • You can also run other commands inside Docker, e.g.
    • $ script/app-env python some_other_module.py --infile "myfile.txt" (to run another module)
    • $ script/app-env python (to get into the Python shell within the container)
  • There is an issue with passing multiple word command line arguments to Docker with this setup even if they are in quotes, just FYI.

docker-template's People

Contributors

wingr avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

nathanhundley

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.