Skip to content

Commit

Permalink
feature/mx-1599 build containers without glueops and loosen deps (#67)
Browse files Browse the repository at this point in the history
# Changes
<!-- Changes in existing functionality -->
- build and push containers without glueops
- loosen dependencies in pyproject.toml
  • Loading branch information
mr-kamran-ali authored Aug 15, 2024
1 parent 20d79c1 commit d4069cc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- use new --frozen-lockfile instead of deprecated --no-lock
- update project requirements, github actions and dependencies
- prevent duplicate github pipelines for test, cve and lint
- build and push containers without glueops
- loosen dependencies in pyproject.toml

### Deprecated

Expand Down
44 changes: 40 additions & 4 deletions mex-{{ cookiecutter.project_name }}/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,48 @@ jobs:
containerize:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: release
steps:
- name: Build, tag and push docker image to ghcr
uses: GlueOps/[email protected]
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache requirements
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
{% raw %}tags: "${{ github.sha }},${{ needs.release.outputs.tag }},latest"{% endraw %}
path: ~/.cache/pip
key: {% raw %}${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}{% endraw %}
restore-keys: |
{% raw %}${{ env.cache-name }}-{% endraw %}
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install requirements
run: make setup

- name: Generate locked requirements.txt
run: |
pdm export --self --output locked-requirements.txt --no-hashes --without dev
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: {% raw %}${{github.actor}}{% endraw %}
password: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}

- name: 'Build Inventory Image'
run: |
docker build .
--tag ghcr.io/robert-koch-institut/mex-{{ cookiecutter.project_name }}:latest
--tag ghcr.io/robert-koch-institut/mex-{{ cookiecutter.project_name }}:{% raw %}${{ github.sha }}{% endraw %}
--tag ghcr.io/robert-koch-institut/mex-{{ cookiecutter.project_name }}:{% raw %}${{ needs.release.outputs.tag }}{% endraw %}
docker push ghcr.io/robert-koch-institut/mex-{{ cookiecutter.project_name }}:latest
distribute:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion mex-{{ cookiecutter.project_name }}/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN adduser \

COPY . .

RUN --mount=type=cache,target=/root/.cache/pip pip install .
RUN --mount=type=cache,target=/root/.cache/pip pip install -r locked-requirements.txt --no-deps

USER mex

Expand Down
16 changes: 8 additions & 8 deletions mex-{{ cookiecutter.project_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ urls = { Repository = "https://github.com/robert-koch-institut/mex-{{ cookiecutt
requires-python = "<3.13,>=3.11"
dependencies = []
optional-dependencies.dev = [
"ipdb==0.13.13",
"mypy==1.11.0",
"pytest-cov==5.0.0",
"pytest-random-order==1.1.1",
"pytest-xdist==3.6.1",
"pytest==8.3.1",
"ruff==0.5.4",
"sphinx==7.4.5",
"ipdb>=0.13.13,<1",
"mypy>=1.11.0,<2",
"pytest-cov>=5.0.0,<6",
"pytest-random-order>=1.1.1,<2",
"pytest-xdist>=3.6.1,<4",
"pytest>=8.3.1,<9",
"ruff>=0.5.4,<1",
"sphinx>=7.4.5,<8",
]

[project.scripts]
Expand Down

0 comments on commit d4069cc

Please sign in to comment.