push docker with CI

This commit is contained in:
Histausse 2023-05-24 12:33:11 +02:00
parent d6e0d933d8
commit 48c95b975a
3 changed files with 26 additions and 4 deletions

View file

@ -16,6 +16,7 @@ for path in REMOVE_PATHS:
else:
os.unlink(path)
subprocess.call(["poetry", "lock"])
subprocess.call(["git", "init"])
subprocess.call(["git", "checkout", "-b", "main"])
subprocess.call(["git", "add", "*"])

View file

@ -16,11 +16,24 @@ pipeline:
pull: true
commands:
- nix build --experimental-features 'nix-command flakes'
- nix build --experimental-features 'nix-command flakes' .#docker
- nix build -o image_link --experimental-features 'nix-command flakes' .#docker
- cp image_link image
when:
matrix:
PYTHON_VERSION: {{ cookiecutter. python_min_version}} # Still not sure about how to make flake for different python version
PYTHON_VERSION: {{ cookiecutter.python_min_version}} # Still not sure about how to make flake for different python version
push_image:
image: quay.io/podman/stable:latest
pull: true
commands:
- podman login -u {{ cookiecutter.git_user }} -p $GITEA_TOKEN {{ cookiecutter.gitea_url.removeprefix('https://') }}
- podman load < image
- podman push {{ cookiecutter.project_slug }}:latest {{ cookiecutter.gitea_url.removeprefix('https://') }}/{{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}:latest
secrets: [ gitea_token ]
when:
matrix:
PYTHON_VERSION: {{ cookiecutter.python_min_version}} # Still not sure about how to make flake for different python version
matrix:
PYTHON_VERSION:
- {{ cookiecutter. python_min_version}}
- {{ cookiecutter.python_min_version}}

View file

@ -23,6 +23,13 @@ There is a `flake.nix`, so you can clone the repo and use `nix shell` if you wan
### Docker/Podman
{% if cookiecutter.configure_ci == "True" %}
You can run this projet with docker or podman:
```
podman run --rm -it {{ cookiecutter.gitea_url.removeprefix('https://') }}/{{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}:latest {{ cookiecutter.project_slug }}
```
{% else %}
You can build a container image using nix. To build the image, in the repo, run:
```
@ -34,8 +41,9 @@ You can then load the image with:
```
podman load < {{ cookiecutter.project_slug }}.img
```
{% endif %}
(If you want to use the image, notice it uses nix and is very minimal).
Notice the image is build with nix and is very minimalist.
{% if is_open_source %}
## License