- copy .env.example to .env
cp app/.env.example app/.envrun with docker-compose
docker-compose -d --buildpip install pre-commitcreate a sample pre-commits file
pre-commit sample-config > .pre-commit-config.yamledit 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:latesttruncate 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_FILEwhere 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 testsor
docker-compose exec fastapi tavern-ci testsLinks
-
Useful
truncate artist restart identity cascade;