- copy .env.example to .env
cp app/.env.example app/.env
run with docker-compose
docker-compose -d --build
pip install pre-commit
create a sample pre-commits file
pre-commit sample-config > .pre-commit-config.yaml
edit this file to add hooks install hooks
pre-commit install --install-hooks
- create personal access token (settings --> Developer settings -- > Personal Access Tokens), select classic
- select write:packages
- save the token to a file
- to see packages, go to your github profile and select tab Packages
- tag an image
docker build -t ghcr.io/tsadimas/pms8-fastapi:latest -f fastapi.Dockerfile .
- login to docker registry
cat ~/github-image-repo.txt | docker login ghcr.io -u tsadimas --password-stdin
- push image
docker push ghcr.io/tsadimas/pms8-fastapi:latest
truncate table artist restart identity cascade;
- create a .dockerconfigjson file, like this
{
"auths": {
"https://ghcr.io":{
"username":"REGISTRY_USERNAME",
"password":"REGISTRY_TOKEN",
"email":"REGISTRY_EMAIL",
"auth":"BASE_64_BASIC_AUTH_CREDENTIALS"
}
}
}
- create <BASE_64_BASIC_AUTH_CREDENTIALS> from the command
echo -n <USER>:<TOKEN> | base64
- create kubernetes secret
apiVersion: v1
kind: Secret
metadata:
name: registry-credentials
namespace: default
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: BASE_64_ENCODED_DOCKER_FILE
where BASE_64_ENCODED_DOCKER_FILE is
cat .dockerconfigjson | base64 -w 0
- pre-commit: A framework for managing and maintaining multi-language pre-commit hooks.
- Github: Working with the Container registry
- Personal access toksns
- Using Gitlab Private Registry with Kubernetes
run
tavern-ci tests
or
docker-compose exec fastapi tavern-ci tests
Links
-
Useful
truncate artist restart identity cascade;