|
4 years ago | |
---|---|---|
.vscode | 4 years ago | |
conf | 4 years ago | |
helm/python-pip-docker-template | 4 years ago | |
python-pip-docker-template | 4 years ago | |
wiki | 4 years ago | |
.gitignore | 4 years ago | |
CHANGELOG.md | 4 years ago | |
Dockerfile | 4 years ago | |
LICENSE | 4 years ago | |
Pipfile | 4 years ago | |
README.md | 4 years ago | |
entrypoint.sh | 4 years ago |
README.md
python-pip-docker-template

Here is a simple repo template for python pip Docker Projects (Sapian Standar)
Features
- Python
- Docker (Miocroservicios)
- pip (pipenv and pip setup)
- kubernetes (Helm Chart)
- Metrics (Prometheus)
- docker buildx (Multiarch)
using this template
new_project_name=new-name
new_project_name_constant=$(echo ${new_project_name^^}| tr "-" "_")
new_project_name_snake=$(echo ${new_project_name}| tr "-" "_")
find . -type f -exec sed -i "s/python-pip-docker-template/${new_project_name}/g" {} \;
find . -type f -exec sed -i "s/PYTHON_PIP_DOCKER_TEMPLATE/${new_project_name_constant}/g" {} \;
find . -type f -exec sed -i "s/python_pip_docker_template/${new_project_name_snake}/g" {} \;
mv python-pip-docker-template/python-pip-docker-template python-pip-docker-template/${new_project_name}
mv python-pip-docker-template ${new_project_name}
Build And Push to docker registry
version=0.1.1
docker build --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VCS_REF=$(git rev-parse --short HEAD) -t sapian/python-pip-docker-template:latest -t sapian/python-pip-docker-template:${version} --build-arg VERSION=${version} .
build multiarch and push
version=0.1.1
docker buildx build --push \
--platform linux/arm64/v8,linux/amd64,linux/arm/v7 \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=$(git rev-parse --short HEAD) \
--tag custom/python-pip-docker-template:latest \
--tag quay.io/custom/python-pip-docker-template:latest \
--tag custom/python-pip-docker-template:${version} \
--tag quay.io/custom/python-pip-docker-template:${version} \
.
Run For Testing
Set Enviroment variables
Fill de file .env
LOG_LEVEL=INFO
Run
docker run --env-file .env --rm -it sapian/python-pip-docker-template:latest
Set developing enviroment
conda create -n python-pip-docker-template python=3.9
/opt/$USER/anaconda3/envs/python-pip-docker-template/bin/pip install pipenv
/opt/$USER/anaconda3/envs/python-pip-docker-template/bin/pipenv --python=/opt/$USER/anaconda3/envs/python-pip-docker-template/bin/python install
/opt/$USER/anaconda3/envs/python-pip-docker-template/bin/pipenv --python=/opt/$USER/anaconda3/envs/python-pip-docker-template/bin/python install --dev
Ipyhon
cd ~/Workspace/python-pip-docker-template/
conda activate python-pip-docker-template
/opt/$USER/anaconda3/envs/python-pip-docker-template/bin/pipenv run ipython