diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c7c6f6..fa9bf42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ jobs: python-version: "3.12" - name: Install dependencies run: | + python -m pip install --upgrade pip setuptools python -m pip install -r requirements/test.txt - name: Run Test run: | diff --git a/.gitignore b/.gitignore index 09ab706..691ec10 100644 --- a/.gitignore +++ b/.gitignore @@ -180,7 +180,7 @@ cython_debug/ .DS_Store # Ruff - .ruff_cache +.ruff_cache # Terraform .terraform* diff --git a/Dockerfile b/Dockerfile index 2d4f7fd..c55d540 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,22 @@ ARG DEBIAN_FRONTEND=noninteractive ARG OUTPUT_BASE_DIR=/data ENV OUTPUT_BASE_DIR=${OUTPUT_BASE_DIR} WORKDIR /app -COPY ./requirements/common.txt requirements/common.txt -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get update \ + && apt-get install --assume-yes --no-install-recommends \ curl \ git \ gnupg \ libpq-dev \ software-properties-common \ - && curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - \ - && apt-add-repository "deb https://apt.releases.hashicorp.com $(lsb_release -cs) main" \ - && apt-get update && apt-get install -y --no-install-recommends terraform \ + && curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg \ + && gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint \ + && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \ + && apt-get update \ + && apt-get install --assume-yes --no-install-recommends \ + terraform \ + && rm -rf /var/lib/apt/lists/* +COPY ./requirements/common.txt requirements/common.txt +RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools \ && python3 -m pip install --no-cache-dir -r requirements/common.txt COPY . . RUN mkdir ${OUTPUT_BASE_DIR} diff --git a/Makefile b/Makefile index 44ce79a..4485ed4 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,9 @@ outdated: ## Check outdated requirements and dependencies .PHONY: pip pip: pip_update ## Compile requirements - python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --upgrade --output-file requirements/common.txt requirements/common.in - python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --upgrade --output-file requirements/local.txt requirements/local.in - python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --upgrade --output-file requirements/test.txt requirements/test.in + python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/common.txt requirements/common.in + python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/local.txt requirements/local.in + python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/test.txt requirements/test.in .PHONY: pip_update pip_update: ## Update requirements and dependencies diff --git a/README.md b/README.md index a7d9b6f..f7d55e1 100644 --- a/README.md +++ b/README.md @@ -6,29 +6,34 @@ ## 🧩 Requirements -The Talos script can be run either using Docker or as a local shell command. +The Talos script can be run either using Docker or a Python virtual environment. ### 🐋 Docker In order to run Talos via Docker, a working [Docker installation](https://docs.docker.com/get-docker/) is the only requirement. -### 👨‍💻 Shell command +### 🐍 Virtual environment -In order to run Talos as a shell command, first clone the repository in a local projects directory +In order to run Talos in a virtual environment, first clone the repository in a local projects directory and ensure it is your current directory: ```console cd ~/projects git clone git@github.com:20tab/talos.git +cd talos ``` -Then, install the following requirements: +Then, create and activate a virtual environment and install the requirements: -| Requirements | Instructions | -| ---------------------- | ---------------------------------------------------------------------------- | -| 🌎 Terraform | [Install Guide](https://learn.hashicorp.com/tutorials/terraform/install-cli) | -| 🐍 Python Dependencies | `pip install -r talos/requirements/common.txt` | +```console +python3.12 -m venv .venv +source .venv/bin/activate +python3 -m pip install --upgrade pip setuptools +python3 -m pip install -r requirements/common.txt +``` + +The `terraform` cli package is required, unless you want to generate a project only locally. To install it we suggest to use the official [install guide](https://learn.hashicorp.com/tutorials/terraform/install-cli). -## 🔑 Credentials +## 🔑 Credentials (optional) ### 🌊 DigitalOcean @@ -57,7 +62,7 @@ If the Terraform Cloud integration is enabled, a User API token is required.