push docker with CI
This commit is contained in:
parent
d6e0d933d8
commit
48c95b975a
|
@ -16,6 +16,7 @@ for path in REMOVE_PATHS:
|
||||||
else:
|
else:
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
||||||
|
subprocess.call(["poetry", "lock"])
|
||||||
subprocess.call(["git", "init"])
|
subprocess.call(["git", "init"])
|
||||||
subprocess.call(["git", "checkout", "-b", "main"])
|
subprocess.call(["git", "checkout", "-b", "main"])
|
||||||
subprocess.call(["git", "add", "*"])
|
subprocess.call(["git", "add", "*"])
|
||||||
|
|
|
@ -16,11 +16,24 @@ pipeline:
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- nix build --experimental-features 'nix-command flakes'
|
- 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:
|
when:
|
||||||
matrix:
|
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:
|
matrix:
|
||||||
PYTHON_VERSION:
|
PYTHON_VERSION:
|
||||||
- {{ cookiecutter. python_min_version}}
|
- {{ cookiecutter.python_min_version}}
|
||||||
|
|
|
@ -23,6 +23,13 @@ There is a `flake.nix`, so you can clone the repo and use `nix shell` if you wan
|
||||||
|
|
||||||
### Docker/Podman
|
### 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:
|
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
|
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 %}
|
{% if is_open_source %}
|
||||||
## License
|
## License
|
||||||
|
|
Loading…
Reference in a new issue