This repository contains a sapling (skeleton) for building a Python Application in Docker using Pipenv that can be uploaded to a Pypi registry.
Python applications that run in Docker can be deployed to Kubernetes, Docker Swarm, or really anywhere!
-
Create a new project based on this sapling.
- Visit ivy-sapling-python38/generate or
- click "Use this template"
Proceed to name your new repository
Protip: project names should be short, and descriptive.
-
Clone the resulting project to your computer
cd ~/code git clone git@github.com:<your-org>/<new-app>.git cd <new-app>
-
Remove this
README.sapling.md
file -
Edit your dependencies
- Install dependencies with pipenv e.g.,
pipenv install <dependency>
, or - edit
Pipfile
- Install dependencies with pipenv e.g.,
-
Add your code
- Update a
main.py
in thesrc
folder containing your main entrypoint - Add your python code and supporting libraries to the
src
folder - Run
pipenv lock
to sync your local dependencies fromPipfile.lock
Dependencies installed, but not listed in your lock file will not be installed in CICD!
- Update a
-
Edit the
Dockerfile
- Find the latest
nxtlytics/base-python38
image in hub.docker.com (see here) and update theFROM
- Ensure your code is captured in the
ADD
statement - Ensure the
CMD
points to your application's entrypoint
- Find the latest
-
Commit your code
- See the section on Workflow for Git workflow processes and best practices
-
Add your project to CICD
-
🎉 Party! 🎉