diff --git a/.gitea/workflows/terraform_auto_apply.yaml b/.gitea/workflows/terraform_auto_apply.yaml new file mode 100644 index 0000000..4e0f242 --- /dev/null +++ b/.gitea/workflows/terraform_auto_apply.yaml @@ -0,0 +1,23 @@ +name: Docker build and push + +on: + push: + branches: + - "main" + +env: + TOKEN: ${{ secrets.GRANT_ALL }} + +jobs: + terraform: + runs-on: ubuntu-dind-noble + steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + - name: ouais + run: | + docker info + docker ps + cat ~/.docker/config.json + diff --git a/.gitea/workflows/terraform_plan.yaml b/.gitea/workflows/terraform_plan.yaml new file mode 100644 index 0000000..0d8f31d --- /dev/null +++ b/.gitea/workflows/terraform_plan.yaml @@ -0,0 +1,37 @@ +name: Terraform plan + +on: + push: + branches-ignore: + - "main" + +env: + TF_HTTP_USERNAME: ${{ secrets.TF_HTTP_USERNAME }} + TF_HTTP_PASSWORD: ${{ secrets.TF_HTTP_PASSWORD }} + OVH_ENDPOINT: ${{ vars.OVH_ENDPOINT }} + OVH_APPLICATION_KEY: ${{ secrets.OVH_APPLICATION_KEY }} + OVH_APPLICATION_SECRET: ${{ secrets.OVH_APPLICATION_SECRET }} + OVH_CONSUMER_KEY: ${{ secrets.OVH_CONSUMER_KEY }} + +jobs: + terraform: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download latest terraform version + run: | + TFV=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version') + curl -JOL "https://releases.hashicorp.com/terraform/${TFV}/terraform_${TFV}_linux_amd64.zip" + unzip "terraform_${TFV}_linux_amd64.zip" + cp terraform /usr/bin/ + chmod +x /usr/bin/terraform + + - name: Terraform Init & Format + run: | + terraform init + terraform fmt -check -recursive + + - name: Terraform Plan + run: terraform plan -out=tfplan diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0e11be7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM gitea.dotty.fr/dotty/ubuntu-poetry-latest:latest +RUN mkdir /app +WORKDIR /app + +COPY poetry.lock pyproject.toml /app/ +RUN poetry install --no-root +COPY main.py /app/ + +CMD ["python", "main.py"] + diff --git a/poetry.lock b/poetry.lock index eaa6531..bf09d8f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -265,6 +265,7 @@ files = [ [package.dependencies] cffi = {version = ">=2.0.0", markers = "python_full_version >= \"3.9.0\" and platform_python_implementation != \"PyPy\""} +typing-extensions = {version = ">=4.13.2", markers = "python_full_version < \"3.11.0\""} [package.extras] docs = ["sphinx (>=5.3.0)", "sphinx-inline-tabs", "sphinx-rtd-theme (>=3.0.0)"] @@ -326,6 +327,19 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "typing-extensions" +version = "4.15.0" +description = "Backported and Experimental Type Hints for Python 3.9+" +optional = false +python-versions = ">=3.9" +groups = ["main"] +markers = "python_full_version < \"3.11.0\"" +files = [ + {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, + {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, +] + [[package]] name = "urllib3" version = "2.5.0" @@ -346,5 +360,5 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.1" -python-versions = ">=3.13" -content-hash = "3a39350e7334cb4a252ccafec69ebd9ab6bf756d04aa5f1448488d2aee012da5" +python-versions = ">=3.10" +content-hash = "85832ddd37ae12d3b07744183307264b264db0279412f38aa9bf8db211f88f61" diff --git a/pyproject.toml b/pyproject.toml index 1486852..0560fc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ {name = "Artémis Michelot",email = "artemis.michelot@gmail.com"} ] readme = "README.md" -requires-python = ">=3.13" +requires-python = ">=3.10" dependencies = [ "requests (>=2.32.5,<3.0.0)", "cryptography (>=46.0.1,<47.0.0)"